{"id":"707efe8039c64e3f","repo":"docker/cli","slug":"could-not-parse-public-key-from-file-s-w","errorCode":null,"errorMessage":"could not parse public key from file: %s: %w","messagePattern":"could not parse public key from file: (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker-trust/trust/signer_add.go","lineNumber":134,"sourceCode":"\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 {\n\t\t\treturn nil, fmt.Errorf(\"unable to read public key from file: %w\", err)\n\t\t}\n\n\t\t// Parse PEM bytes into type PublicKey\n\t\tpubKey, err := tufutils.ParsePEMPublicKey(pubKeyBytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not parse public key from file: %s: %w\", pubKeyPath, err)\n\t\t}\n\t\tpubKeys = append(pubKeys, pubKey)\n\t}\n\treturn pubKeys, nil\n}\n","sourceCodeStart":116,"sourceCodeEnd":140,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cmd/docker-trust/trust/signer_add.go#L116-L140","documentation":"Error \"could not parse public key from file: %s: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cmd/docker-trust/trust/signer_add.go:134 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}