{"id":"14894d897b592aa7","repo":"docker/cli","slug":"could-not-add-signer-to-repo-s-w-14894d","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/signer_add.go","lineNumber":109,"sourceCode":"\t}\n\n\tif _, err = notaryRepo.ListTargets(); err != nil {\n\t\tswitch err.(type) {\n\t\tcase client.ErrRepoNotInitialized, client.ErrRepositoryNotExist:\n\t\t\t_, _ = fmt.Fprintf(dockerCLI.Out(), \"Initializing signed repository for %s...\\n\", repoName)\n\t\t\tif err := getOrGenerateRootKeyAndInitRepo(notaryRepo); err != nil {\n\t\t\t\treturn trust.NotaryError(repoName, err)\n\t\t\t}\n\t\t\t_, _ = fmt.Fprintf(dockerCLI.Out(), \"Successfully initialized %q\\n\", repoName)\n\t\tdefault:\n\t\t\treturn trust.NotaryError(repoName, err)\n\t\t}\n\t}\n\n\tnewSignerRoleName := data.RoleName(path.Join(data.CanonicalTargetsRole.String(), signerName))\n\n\tif err := addStagedSigner(notaryRepo, newSignerRoleName, signerPubKeys); err != nil {\n\t\treturn fmt.Errorf(\"could not add signer to repo: %s: %w\", strings.TrimPrefix(newSignerRoleName.String(), \"targets/\"), err)\n\t}\n\n\treturn notaryRepo.Publish()\n}\n\nfunc ingestPublicKeys(pubKeyPaths []string) ([]data.PublicKey, error) {\n\tpubKeys := []data.PublicKey{}\n\tfor _, pubKeyPath := range pubKeyPaths {\n\t\t// Read public key bytes from PEM file, limit to 1 KiB\n\t\tpubKeyFile, err := os.OpenFile(pubKeyPath, os.O_RDONLY, 0o666)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to read public key from file: %w\", err)\n\t\t}\n\t\tdefer pubKeyFile.Close()\n\t\t// limit to\n\t\tl := io.LimitReader(pubKeyFile, 1<<20)\n\t\tpubKeyBytes, err := io.ReadAll(l)\n\t\tif err != nil {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cmd/docker-trust/trust/signer_add.go#L91-L127","documentation":"Error \"could not add signer to repo: %s: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cmd/docker-trust/trust/signer_add.go:109 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}