{"record":{"id":"3b2b8814556bd6a2","repo":"semaphoreui/semaphore","slug":"adding-private-key-w","errorCode":null,"errorMessage":"adding private key: %w","messagePattern":"adding private key: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/ssh/agent.go","lineNumber":58,"sourceCode":"\t\tvar (\n\t\t\tkey any\n\t\t\terr error\n\t\t)\n\n\t\tif len(k.Passphrase) == 0 {\n\t\t\tkey, err = ssh.ParseRawPrivateKey(k.Key)\n\t\t} else {\n\t\t\tkey, err = ssh.ParseRawPrivateKeyWithPassphrase(k.Key, k.Passphrase)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parsing private key: %w\", err)\n\t\t}\n\n\t\tif err := keyring.Add(agent.AddedKey{\n\t\t\tPrivateKey: key,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"adding private key: %w\", err)\n\t\t}\n\t}\n\n\tif err := os.MkdirAll(path.Dir(a.SocketFile), 0o755); err != nil {\n\t\treturn fmt.Errorf(\"creating socket directory: %w\", err)\n\t}\n\n\tl, err := net.ListenUnix(\n\t\t\"unix\",\n\t\t&net.UnixAddr{\n\t\t\tNet:  \"unix\",\n\t\t\tName: a.SocketFile,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"listening on socket %q: %w\", a.SocketFile, err)\n\t}\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/pkg/ssh/agent.go#L40-L76","documentation":"Returned by Agent.Listen in pkg/ssh/agent.go when the parsed private key is accepted by x/crypto/ssh but the in-memory agent keyring rejects it in keyring.Add. This is a runtime guard around agent.AddedKey insertion: it typically fires when the key type is not usable as an agent signing key or the AddedKey struct is otherwise invalid for the keyring, and the %w carries the x/crypto/agent rejection reason.","triggerScenarios":"Thrown at pkg/ssh/agent.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for the keyring's rejection reason (e.g. unsupported key type for signing)","Confirm the key is a usable signing key (ed25519, RSA, ECDSA) and not a certificate-only or public-key blob","Try loading the same key with ssh-add locally to confirm it is agent-compatible, then re-store the key material in Semaphore"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}