{"record":{"id":"be649afff915c85e","repo":"ipfs/kubo","slug":"invalid-probe-cid-w","errorCode":null,"errorMessage":"invalid probe CID: %w","messagePattern":"invalid probe CID: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/diag.go","lineNumber":64,"sourceCode":"\tHelptext: cmds.HelpText{\n\t\tTagline: \"Report whether the daemon is operational.\",\n\t\tShortDescription: `\nExits 0 if the daemon is running and can resolve the well-known empty\nUnixFS directory. Exits non-zero if shutdown has started or the DAG\npipeline is broken. Intended for container healthchecks.\n`,\n\t},\n\tRun: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tif t := shutdown.StartedAt(); !t.IsZero() {\n\t\t\treturn fmt.Errorf(\"daemon is shutting down (started %s ago)\", time.Since(t).Round(time.Second))\n\t\t}\n\t\tapi, err := cmdenv.GetApi(env, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprobeCID, err := cid.Decode(diagHealthyProbeCIDStr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid probe CID: %w\", err)\n\t\t}\n\t\tif _, _, err := api.ResolvePath(req.Context, path.FromCid(probeCID)); err != nil {\n\t\t\treturn fmt.Errorf(\"probe resolve: %w\", err)\n\t\t}\n\t\tif _, err := api.Dag().Get(req.Context, probeCID); err != nil {\n\t\t\treturn fmt.Errorf(\"probe fetch: %w\", err)\n\t\t}\n\t\treturn cmds.EmitOnce(res, \"ok\")\n\t},\n}\n\nvar diagDatastoreCmd = &cmds.Command{\n\tStatus: cmds.Experimental,\n\tHelptext: cmds.HelpText{\n\t\tTagline: \"Low-level datastore inspection for debugging and testing.\",\n\t\tShortDescription: `\n'ipfs diag datastore' provides low-level access to the datastore for debugging\nand testing purposes.","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/diag.go#L46-L82","documentation":"`ipfs diag healthy` decodes a hardcoded probe CID constant (diagHealthyProbeCIDStr); if cid.Decode fails the command wraps the error as 'invalid probe CID'. This indicates the compiled-in probe CID constant is malformed — effectively a build/code defect, not user input.","triggerScenarios":"cid.Decode(diagHealthyProbeCIDStr) returns an error, i.e. the constant in core/commands/diag.go is not a valid CID string.","commonSituations":"Patched/forked builds where the constant was edited incorrectly; rarely seen in upstream builds.","solutions":["Rebuild kubo from a clean upstream checkout","Inspect diagHealthyProbeCIDStr in core/commands/diag.go and fix the constant","File an issue if it occurs on an official release"],"exampleFix":"// before\nconst diagHealthyProbeCIDStr = \"bafy...typo\"\n// after\nconst diagHealthyProbeCIDStr = \"bafkreiefnkxuhnqny3rjrkxqnmu4fyptx47vs3s25v7dlo7kcqbkqg3mka\" // valid CID","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := cid.Decode(probeCIDStr); err != nil { return fmt.Errorf(\"invalid probe CID: %w\", err) }\n// catch: inspect wrapped cid error, fix the constant","preventionTips":["Keep the probe CID constant as a tested value","Add a unit test asserting cid.Decode(diagHealthyProbeCIDStr) succeeds"],"tags":["diag","cid","internal"],"backgroundTag":"invalid-cid","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}