Runtime error when automating with CLI

Community Member

Im trying to do some automation through the CLI where i use the following "Op" commands:
op item get $line --vault private --field password
op item edit $line --vault private --generate-password='letters,digits,symbols,32'

30% of the time i run the script, i encounter a Runtime error: runtime: waitforsingleobject wait_failed; errno=6
fatal error: runtime.semasleep wait_failed.

Can anyone help me with why it fails 30% of the time, but works perfectly the other 70%? Its random if it breaks on the first try in my "For each" loop or somewhere in the middle.

Entire error:
runtime: waitforsingleobject wait_failed; errno=6
fatal error: runtime.semasleep wait_failed
runtime stack:
runtime.throw({0x8cabcf, 0x1d})
/usr/local/go/src/runtime/panic.go:1047 +0x4d fp=0x3509f6d0 sp=0x3509f6bc pc=0x148d5d
/usr/local/go/src/runtime/os_windows.go:856 +0x70 fp=0x3509f6e0 sp=0x3509f6d0 pc=0x144f20
/usr/local/go/src/runtime/os_windows.go:854 +0xd1 fp=0x3509f724 sp=0x3509f6e0 pc=0x145001
runtime.notetsleep_internal(0xe65f6c, 0x186a0, 0x0, 0x0)
/usr/local/go/src/runtime/lock_sema.go:232 +0x125 fp=0x3509f748 sp=0x3509f724 pc=0x11aa55
runtime.notetsleep(0xe65f6c, 0x186a0)
/usr/local/go/src/runtime/lock_sema.go:283 +0x65 fp=0x3509f768 sp=0x3509f748 pc=0x11ac45
/usr/local/go/src/runtime/proc.go:1645 +0x260 fp=0x3509f79c sp=0x3509f768 pc=0x14e5b0
/usr/local/go/src/runtime/mgc.go:814 +0x52 fp=0x3509f7b0 sp=0x3509f79c pc=0x128152
/usr/local/go/src/runtime/asm_386.s:370 +0x41 fp=0x3509f7b4 sp=0x3509f7b0 pc=0x175b81

goroutine 30 [GC worker (idle)]:
/usr/local/go/src/runtime/asm_386.s:337 fp=0x12755f60 sp=0x12755f5c pc=0x175b30
/usr/local/go/src/runtime/mgc.go:807 +0xda fp=0x12755f94 sp=0x12755f60 pc=0x1282fa
/usr/local/go/src/runtime/mgc.go:1367 +0x339 fp=0x12755ff0 sp=0x12755f94 pc=0x129dd9
/usr/local/go/src/runtime/asm_386.s:1326 +0x1 fp=0x12755ff4 sp=0x12755ff0 pc=0x177001
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1159 +0x25

etc.etc.etc.etc. Its too long to post.

1Password Version: 8.9.8
Extension Version: 2.7.3
OS Version: Windows 10 21H2
Browser:_ Not Provided


  • Pelitkm
    Community Member


    I've done some more testing, and the same error happens if I just run the single command in a CMD multiple times. So it doesn't have anything to do with my script, but an error in the CLI/communication with the cloud. I've made sure there is no HTTPS inspection through our firewall towards 1password, so it isn't an issue here.

  • Pelitkm
    Community Member

    It looks like it might be a bug in CLI version 2.7.3. How i even got that version i dont know, as the powershell script i ran says:
    "Invoke-WebRequest -Uri "$($opArch)" -OutFile".
    That version works for a colleague. I've now downloaded version 2.9.1 and i cant seem to get it to fail. However i cant seem to locate version 2.7.3 so i can purge it.

  • Pelitkm
    Community Member

    I encountered the error again after updating to 2.9.1. I then tried to stress test it in a CMD. And i encountered this error, first time i get it:
    "[ERROR] 2022/12/13 10:45:31 failed to keysetsAPI.GetAllEncrypted: Get "": read tcp :MY_IP:52252-> wsarecv: An established connection was aborted by the software in your host machine."

    This made me think that maybe the "connect with 1password CLI" setting in the windows app was at fault. And after disabling the feature I've ran 100 calls without the Runtime error. And it usually failed 30% of the time. So I think its safe to assume the Windows client is causing the bug, with the integration to the CLI.

  • Hi @Pelitkm:

    Thanks for letting us know about this. We're actively investigating this, so please keep an eye out for updates.


    ref: dev/b5/op#2611

  • Kn0rki
    Community Member

    hi folks,

    im new to 1password and have same issue with CLI 2.10.0 in my Powershell Script:
    $chatid = "$(op read op://Private/TelegramBot/chat_id)"
    and sometimes it gives me a looooong error message.

    -- snip --
    runtime: setevent failed; errno=6
    fatal error: runtime.semawakeup

    runtime stack:
    runtime.throw({0x142185e?, 0x9f5e65?})
    /usr/local/go/src/runtime/panic.go:1047 +0x65 fp=0x75b7bffc28 sp=0x75b7bffbf8 pc=0x9f93c5
    /usr/local/go/src/runtime/os_windows.go:874 +0x70 fp=0x75b7bffc50 sp=0x75b7bffc28 pc=0x9f52d0
    /usr/local/go/src/runtime/os_windows.go:872 +0x56 fp=0x75b7bffc78 sp=0x75b7bffc50 pc=0x9f5336
    /usr/local/go/src/runtime/lock_sema.go:161 +0x4e fp=0x75b7bffc98 sp=0x75b7bffc78 pc=0x9cc60e
    runtime.startm(0x0, 0x1)
    /usr/local/go/src/runtime/proc.go:2344 +0x1e8 fp=0x75b7bffce0 sp=0x75b7bffc98 pc=0x9ffd48
    /usr/local/go/src/runtime/proc.go:2430 +0x5a fp=0x75b7bffd00 sp=0x75b7bffce0 pc=0xa0019a
    /usr/local/go/src/runtime/proc.go:3110 +0x45 fp=0x75b7bffd20 sp=0x75b7bffd00 pc=0xa01b65
    /usr/local/go/src/runtime/proc.go:3220 +0xe5 fp=0x75b7bffd58 sp=0x75b7bffd20 pc=0xa01fa5
    /usr/local/go/src/runtime/proc.go:3363 +0x14d fp=0x75b7bffd88 sp=0x75b7bffd58 pc=0xa024ad
    /usr/local/go/src/runtime/asm_amd64.s:448 +0x4a fp=0x75b7bffd98 sp=0x75b7bffd88 pc=0xa26a0a

    goroutine 1 [runnable]:
    math/big.nat.divBasic({0xc00042f4a0, 0x11, 0x15?}, {0xc000328000, 0x21, 0x24}, {0xc000034900, 0x10, 0x44})
    /usr/local/go/src/math/big/natdiv.go:621 +0x718 fp=0xc000454e30 sp=0xc000454e28 pc=0xbb26b8
    math/big.nat.divLarge({0x0, 0x0?, 0x0}, {0xc000328000, 0x10?, 0x24}, {0xc000328000, 0x10?, 0x24}, {0xc00042ec60, ...})
    /usr/local/go/src/math/big/natdiv.go:603 +0x3a6 fp=0xc000454f08 sp=0xc000454e30 pc=0xbb1dc6
    math/big.nat.div({0x0?, 0x0, 0x0}, {0xc000328000?, 0x20, 0x24}, {0xc000328000?, 0x20, 0x24}, {0xc00042ec60, ...})
    /usr/local/go/src/math/big/natdiv.go:525 +0x328 fp=0xc000454fc8 sp=0xc000454f08 pc=0xbb1408
    math/big.(Int).QuoRem(0xc0004550b0, 0xc00025f1e0, 0xc00025f100, 0xc00025f1e0)
    /usr/local/go/src/math/big/int.go:237 +0x9c fp=0xc000455050 sp=0xc000454fc8 pc=0xb9fffc
    Int).Mod(0xc00025f1e0, 0xc00025f1e0?, 0xc00025f1a0?)
    /usr/local/go/src/math/big/int.go:268 +0x205 fp=0xc000455100 sp=0xc000455050 pc=0xba03a5
    crypto/rsa.decrypt({0x1593c80?, 0x1c0f100}, 0xc00025b200, 0xc00029f338)
    /usr/local/go/src/crypto/rsa/rsa.go:599 +0x56c fp=0xc000455270 sp=0xc000455100 pc=0xc1b54c
    crypto/rsa.DecryptOAEP({0x159dc00, 0xc000450620}, {0x1593c80, 0x1c0f100}, 0xc00025b200, {0xc000102600, 0x100, 0x100}, {0x0,
    0x0, ...})
    /usr/local/go/src/crypto/rsa/rsa.go:676 +0x211 fp=0xc000455368 sp=0xc000455270 pc=0xc1bb31, 0xc000261200)
    /builds/dev/b5/op/vendor/ +0x345 fp=0xc000455418 sp=0xc000455368 pc=0xc889a5
    KeysetV1).DecryptV1(0x5?, 0x80?)
    /builds/dev/b5/op/vendor/ +0xc7 fp=0xc000455468 sp=0xc000455418
    pc=0xc85ac7, {0x15996d0?, 0xc00032d020?})
    /builds/dev/b5/op/vendor/ +0x54 fp=0xc000455520 sp=0xc000455468 pc=0xc83894
    EncryptedKeysetV1).Decrypt(0x12e8da0?, {0x211746dd7d8?, 0xc00032d020})
    /builds/dev/b5/op/vendor/ +0x45 fp=0xc000455550 sp=0xc000455520 pc=0xc837e5

    -- snap --

  • Hey folks! We have just released v2.11.0 of 1Password CLI, which should address this issue. See Update to the latest version of 1Password CLI for instructions on how to update.

    Let us know if you are still having issues with v2.11.0 or later.

  • Pelitkm
    Community Member

    Hi @Joris_1P

    I've ran 100 calls this morning after updating to V2.11.0, and i dont get the error anymore. Thanks for the update. :)

  • Thanks for confirming. That's great to hear!

  • Pelitkm
    Community Member

    @Joris_1P a Side note:
    Your guide here:
    Has Invoke-WebRequest ... v2.4.1 ....

    I was working with that version for a while because it didn't occur to me your documentation was that far out of date. Maybe you could make a link to "latest" like you do with the Windows app?

  • That's very good feedback. I agree with you that I'd expect that to use the latest version.

    I'll loop that back to our team. Thanks for sharing this! 🙌

This discussion has been closed.