Forum Discussion

crumpstar's avatar
crumpstar
New Contributor
11 months ago

Unable to create new item with empty password with cli

I'm using cli 2.28.0

op item get "item-uuid" --format=json | op item create --vault=runtime-testing --tags=test

is returning "unable to process line 1: Validation: (validateVaultItem failed to Validate), Couldn't validate the item: "[ItemValidator] has found 1 errors, 0 warnings: \nErrors:{1. Password item requires ps value}"

"item-uuid" is a correct UUID for an existing item of "category": "PASSWORD". This only happens when the 'item-uuid" has an empty value for password. The 1password app allows me to create/save an item with an empty password thus I would expect the CLI to allow the same.

Note that if I use the --generate-password option it will create the item. However i want the password to be empty.


1Password Version: 8.10.30
Extension Version: Not Provided
OS Version: macOS 14.4.1
Browser: Not Provided

  • radik's avatar
    radik
    New Contributor

    Was facing with the same issue while working with ansible 1Password Connect collection - "Password item requires ps value".

    Migrated all the items from "Password" template to "API Credential" as legojoey17 mentioned and it fixed this issue

  • legojoey17's avatar
    legojoey17
    New Contributor

    Huh, well I guess it's just impossible to make a Password type without a password. I found just taking the op item template get "Password" template, removing all of the existing fields, it will still fail even without the field template.

    I'm also quite confused as there isn't anything on the 1Password CLI docs referencing ps, like where I may expect it on:
    - https://developer.1password.com/docs/cli/item-fields/
    - https://developer.1password.com/docs/cli/item-template-json/

    For now I found I'm able to just use an "API Credential" type without any validation errors provided only a few custom fields.

  • legojoey17's avatar
    legojoey17
    New Contributor

    I believe I figured out what's happened here. I just ran into this today with an item created using the latest version of the MacOS desktop client (1Password for Mac 8.10.56 (81056028)). I create a Password-type item, pasted some text into the password, saved it, and subsequently removed the password value - I intended to store a multi-value secret where there was no one "password" but a few distinct fields.

    I found this post and figured I'd inspect the actual JSON and it became obvious once I did op item get --format=json .... The password field has no value, but is present and shows the previous value in the history. I suspect the CLI validation is simply inconsistent with how the 1Password apps validate/format this, and it also looks like it's probably for UX such as for retaining history.

    Here's what the JSON looked like (just those CONCEALED extra fields removed and things stripped out for ....

    ```
    {
    "id": "...",
    "title": "...",
    "version": "...",
    "vault": {
    "id": "...",
    "name": "..."
    },
    "category": "PASSWORD",
    "last_edited_by": "...",
    "created_at": "2025-01-18T08:36:08Z",
    "updated_at": "2025-01-18T20:04:58Z",
    "additional_information": "2025-01-18 12:36 AM",
    "sections": [
    {
    "id": "add more"
    }
    ],
    "fields": [
    {
    "id": "password",
    "type": "CONCEALED",
    "purpose": "PASSWORD",
    "label": "password",
    "reference": "op://.../.../password",
    "password_details": {
    "history": ["... some previous value"]
    }
    },
    {
    "id": "notesPlain",
    "type": "STRING",
    "purpose": "NOTES",
    "label": "notesPlain",
    "value": "...",
    "reference": "op://.../.../notesPlain"
    }
    // additional fields ...
    ]
    }

    ```

  • asteurer's avatar
    asteurer
    New Contributor

    I'm running into the same error message when I try to run this command:

    op item edit my_item --vault my_vault "test_password=TEST"

    Here's the error message:

    [ERROR] 2024/10/24 20:23:47 validateVaultItem failed to Validate: Couldn't validate the item: "[ItemValidator] has found 1 errors, 0 warnings: \nErrors:{1. Password item requires ps value}"

    I'm using op version 2.30.0 on Ubuntu 24.04.1 LTS.

  • Hey crumpstar , I'm really sorry to hear you're running into some troubles with the CLI!

    I've done some testing on my end and have not been able to replicate your issue running op item get "item-uuid" --format=json | op item create --vault="vault-name" --tags=test with either a password item or a login item that has nothing set in the password field.

    There is a chance that the item's json has broken behind the scenes. This is incredibly rare, however it can sometimes happen if the item was created or edited using a flawed release of the 1Password desktop app at some point in the past.

    As a test, if you re-create the password item from scratch (and not manually copy it), in whichever vault you are attempting to make a copy of it out of, and then re-run the command using the 1Password CLI does it continue to run into this issue?

    • micromicio's avatar
      micromicio
      New Contributor

      Hi jacob_o_1p, we are currently facing the same issue with the latest version of 1Password and the CLI. Can you make the CLI robust to these scenarios? It will prevent our automation built on top of it to break