Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

mickael's avatar
mickael
Contributor
3 years ago

Trouble with new JSON forma with CLI 2.0

Hi,

I have upgraded 1password CLI to 2.0 and I am working on the update of my helpers scripts: https://github.com/mickaelperrin/onepassword-tools

I try to create a new login entry with the following JSON stored in a temporaray file (/var/folders/t0/4z0_cwt538d4qkkvnpb81_6m0000gn/T/tmp_yv7ifot)


debug: {
debug: "sections": [
debug: {
debug: "title": "",
debug: "name": "Section_jlcceacsdqaeeqyzxveurjevhqvhr"
debug: }
debug: ],
debug: "fields": [
debug: {
debug: "id": "notesPlain",
debug: "type": "STRING",
debug: "purpose": "NOTES",
debug: "label": "notesPlain"
debug: },
debug: {
debug: "value": "mickaelperrin",
debug: "id": "username",
debug: "purpose": "USERNAME",
debug: "label": "username"
debug: },
debug: {
debug: "value": "EMerxisXs3r9I.PHLtH0kdd+B",
debug: "id": "password",
debug: "type": "CONCEALED",
debug: "purpose": "PASSWORD",
debug: "label": "password"
debug: },
debug: {
debug: "id": "notesPlain",
debug: "type": "STRING",
debug: "purpose": "NOTES",
debug: "label": "notesPlain"
debug: },
debug: {
debug: "label": "UUID",
debug: "value": "22cd2b81-7c5b-4fa2-99c9-bcdb818656bf",
debug: "type": "STRING",
debug: "id": "nertivikkjodthpyolqtqzxwdc",
debug: "section": {
debug: "title": "",
debug: "name": "Section_jlcceacsdqaeeqyzxveurjevhqvhr"
debug: }
debug: }
debug: ]
debug: }

and running the following command


op item create --category "Login" --template /var/folders/t0/4z0_cwt538d4qkkvnpb81_6m0000gn/T/tmp_yv7ifot --title="ACCOUNT mickaelperrin ON https://test.fr"; --url="https://test.fr" --account=my

I got the following error:


[ERROR] 2022/03/30 20:11:25 too many "username" fields in Apply(): You can only use one "username" field.

I don't know what's going wrong. Any help is appreciated.

Thanks,


1Password Version: 7.9.3
Extension Version: 2.0.0
OS Version: 12.3

  • I didn't notice that I had twice "notesPlain" fields. I removed one, but I am still getting the issue related to "username"

  • I tried with some variations of "Login": login, LOGIN, "LOGIN", "login", but it looks like I have only the issue when using --category "Login" but not when adding the category in the JSON directly. Strange.

  • Former Member's avatar
    Former Member

    Well...that's a bug.
    Thank you so much for reaching out to us and reporting!
    I've just opened an internal ticket and will bring it up in our next team meeting.

    Please make sure to report anything else that you might find, and, once again, thank you!

    Best,
    Horia