{"record":{"id":"4e1a17a5db57c09a","repo":"benbjohnson/litestream","slug":"start-failed-s","errorCode":null,"errorMessage":"start failed: %s","messagePattern":"start failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/start.go","lineNumber":77,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal request: %w\", err)\n\t}\n\n\tresp, err := client.Post(\"http://localhost/start\", \"application/json\", bytes.NewReader(reqBody))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to connect to control socket: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read response: %w\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tvar errResp litestream.ErrorResponse\n\t\tif err := json.Unmarshal(body, &errResp); err == nil && errResp.Error != \"\" {\n\t\t\treturn fmt.Errorf(\"start failed: %s\", errResp.Error)\n\t\t}\n\t\treturn fmt.Errorf(\"start failed: %s\", string(body))\n\t}\n\n\tvar result litestream.StartResponse\n\tif err := json.Unmarshal(body, &result); err != nil {\n\t\treturn fmt.Errorf(\"failed to parse response: %w\", err)\n\t}\n\n\tconfirmation := StartStopResult{\n\t\tStatus: result.Status,\n\t\tDBPath: result.Path,\n\t\tState:  \"running\",\n\t\tTXID:   result.TXID,\n\t\tSocket: *socketPath,\n\t}\n\tif err := printStartStopResult(confirmation, *jsonOutput); err != nil {\n\t\treturn err","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/start.go#L59-L95","documentation":"The daemon returned a non-200 status for the /start request and its body parsed as a litestream.ErrorResponse containing an Error message; the CLI surfaces that server-side message prefixed with 'start failed:'. The actual cause is in the suffix text, which comes from the daemon's own replication-start logic.","triggerScenarios":"POSTing /start to the control socket and the daemon rejects the request — e.g. the database path is not registered with the daemon, the database is already running, or replication failed to start (LTX errors, storage unavailable).","commonSituations":"Typo'd DB path not registered in the daemon config; database already replicating (duplicate start); replica storage credentials invalid so replication can't start; database locked or WAL error server-side.","solutions":["Read the text after 'start failed:' — it is the daemon's own error message","Verify the DB path is registered in the daemon's config and matches exactly","If already running, use `litestream status` instead of starting again","Check daemon logs for the underlying replication error","Run `litestream reset <db>` if the daemon reports corrupted local LTX state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// confirm DB is registered before starting:\n// litestream status /path/to/db  → must list the database","typeGuard":null,"tryCatchPattern":"if err != nil {\n    var msg string\n    if _, perr := fmt.Sscanf(err.Error(), \"start failed: %s\", &msg); perr == nil {\n        log.Printf(\"daemon rejected start: %s\", msg)\n    }\n}","preventionTips":["Register the DB path exactly (absolute path) in the daemon config","Check `litestream status` before issuing start to avoid duplicate starts","Validate replica storage credentials before running start in automation"],"tags":["cli","ipc","http","replication"],"backgroundTag":"http-error-response","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}