{"id":"09716f5171b067b0","repo":"docker/cli","slug":"could-not-add-signer-to-repo-s-w","errorCode":null,"errorMessage":"could not add signer to repo: %s: %w","messagePattern":"could not add signer to repo: (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker-trust/trust/sign.go","lineNumber":214,"sourceCode":"\nfunc initNotaryRepoWithSigners(notaryRepo notaryclient.Repository, newSigner data.RoleName) error {\n\trootKey, err := getOrGenerateNotaryKey(notaryRepo, data.CanonicalRootRole)\n\tif err != nil {\n\t\treturn err\n\t}\n\trootKeyID := rootKey.ID()\n\n\t// Initialize the notary repository with a remotely managed snapshot key\n\tif err := notaryRepo.Initialize([]string{rootKeyID}, data.CanonicalSnapshotRole); err != nil {\n\t\treturn err\n\t}\n\n\tsignerKey, err := getOrGenerateNotaryKey(notaryRepo, newSigner)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := addStagedSigner(notaryRepo, newSigner, []data.PublicKey{signerKey}); err != nil {\n\t\treturn fmt.Errorf(\"could not add signer to repo: %s: %w\", strings.TrimPrefix(newSigner.String(), \"targets/\"), err)\n\t}\n\n\treturn notaryRepo.Publish()\n}\n\n// generates an ECDSA key without a GUN for the specified role\nfunc getOrGenerateNotaryKey(notaryRepo notaryclient.Repository, role data.RoleName) (data.PublicKey, error) {\n\t// use the signer name in the PEM headers if this is a delegation key\n\tif data.IsDelegation(role) {\n\t\trole = data.RoleName(notaryRoleToSigner(role))\n\t}\n\tkeys := notaryRepo.GetCryptoService().ListKeys(role)\n\tvar err error\n\tvar key data.PublicKey\n\t// always select the first key by ID\n\tif len(keys) > 0 {\n\t\tsort.Strings(keys)\n\t\tkeyID := keys[0]","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cmd/docker-trust/trust/sign.go#L196-L232","documentation":"Error \"could not add signer to repo: %s: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cmd/docker-trust/trust/sign.go:214 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}