{"id":"f902c51dce030f4f","repo":"docker/cli","slug":"failed-to-add-signer-to-s","errorCode":null,"errorMessage":"failed to add signer to: %s","messagePattern":"failed to add signer to: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker-trust/trust/signer_add.go","lineNumber":77,"sourceCode":"\tif options.keys.Len() == 0 {\n\t\treturn errors.New(\"path to a public key must be provided using the `--key` flag\")\n\t}\n\tsignerPubKeys, err := ingestPublicKeys(options.keys.GetSlice())\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar errRepos []string\n\tfor _, repoName := range options.repos {\n\t\t_, _ = fmt.Fprintf(dockerCLI.Out(), \"Adding signer \\\"%s\\\" to %s...\\n\", signerName, repoName)\n\t\tif err := addSignerToRepo(ctx, dockerCLI, signerName, repoName, signerPubKeys); err != nil {\n\t\t\t_, _ = fmt.Fprintln(dockerCLI.Err(), err.Error()+\"\\n\")\n\t\t\terrRepos = append(errRepos, repoName)\n\t\t} else {\n\t\t\t_, _ = fmt.Fprintf(dockerCLI.Out(), \"Successfully added signer: %s to %s\\n\\n\", signerName, repoName)\n\t\t}\n\t}\n\tif len(errRepos) > 0 {\n\t\treturn fmt.Errorf(\"failed to add signer to: %s\", strings.Join(errRepos, \", \"))\n\t}\n\treturn nil\n}\n\nfunc addSignerToRepo(ctx context.Context, dockerCLI command.Cli, signerName string, repoName string, signerPubKeys []data.PublicKey) error {\n\timgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, authResolver(dockerCLI), repoName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnotaryRepo, err := newNotaryClient(dockerCLI, imgRefAndAuth, trust.ActionsPushAndPull)\n\tif err != nil {\n\t\treturn trust.NotaryError(imgRefAndAuth.Reference().Name(), err)\n\t}\n\n\tif _, err = notaryRepo.ListTargets(); err != nil {\n\t\tswitch err.(type) {\n\t\tcase client.ErrRepoNotInitialized, client.ErrRepositoryNotExist:","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cmd/docker-trust/trust/signer_add.go#L59-L95","documentation":"Error \"failed to add signer to: %s\" thrown in docker/cli.","triggerScenarios":"Thrown at cmd/docker-trust/trust/signer_add.go:77 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}