{"record":{"id":"9d51bf5baa2bae23","repo":"benbjohnson/litestream","slug":"failed-to-format-response-w-9d51bf","errorCode":null,"errorMessage":"failed to format response: %w","messagePattern":"failed to format response: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/litestream/start.go","lineNumber":113,"sourceCode":"\t\treturn err\n\t}\n\n\treturn nil\n}\n\ntype StartStopResult struct {\n\tStatus string `json:\"status\"`\n\tDBPath string `json:\"db_path\"`\n\tState  string `json:\"state\"`\n\tTXID   uint64 `json:\"txid\"`\n\tSocket string `json:\"socket\"`\n}\n\nfunc printStartStopResult(result StartStopResult, jsonOutput bool) error {\n\tif jsonOutput {\n\t\toutput, err := json.MarshalIndent(result, \"\", \"  \")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to format response: %w\", err)\n\t\t}\n\t\tfmt.Println(string(output))\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"status: %s\\n\", result.Status)\n\tfmt.Printf(\"db_path: %s\\n\", result.DBPath)\n\tfmt.Printf(\"state: %s\\n\", result.State)\n\tfmt.Printf(\"txid: %d\\n\", result.TXID)\n\tfmt.Printf(\"socket: %s\\n\", result.Socket)\n\n\treturn nil\n}\n\n// Usage prints the help text for the start command.\nfunc (c *StartCommand) Usage() {\n\tfmt.Println(`\nusage: litestream start [OPTIONS] DB_PATH","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/start.go#L95-L131","documentation":"printStartStopResult failed to json.MarshalIndent the StartStopResult for -json output. In practice MarshalIndent on this all-string/uint64 struct never fails, so this is a defensive error path; it would only trigger if the struct gained an unsupported field type (e.g. a channel or func) in the future.","triggerScenarios":"Calling printStartStopResult(result, true) where result contains a value json cannot encode — not reachable with the current StartStopResult fields (Status, DBPath, State, TXID, Socket).","commonSituations":"Only arises during development if StartStopResult is extended with unmarshalable types (chan, func, cyclic pointers).","solutions":["No user action needed; the current struct is always marshalable","If you modified StartStopResult, remove or pre-convert any chan/func/custom fields to JSON-safe types","Use json output normally; if you somehow see this, report it with your litestream version"],"exampleFix":"// before\ntype StartStopResult struct {\n    Hook func() `json:\"hook\"` // unmarshalable\n}\n// after\ntype StartStopResult struct {\n    Status string `json:\"status\"`\n    DBPath string `json:\"db_path\"`\n    State  string `json:\"state\"`\n    TXID   uint64 `json:\"txid\"`\n    Socket string `json:\"socket\"`\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep StartStopResult fields limited to JSON-safe types (string, uint64)","Never add chan/func fields to output structs","Add a unit test that marshals StartStopResult with -json path covered"],"tags":["json","cli","output"],"backgroundTag":"json-marshal-failed","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}