{"record":{"id":"01ffbef001ff00b5","repo":"rqlite/rqlite","slug":"failed-to-parse-auto-backup-file-s","errorCode":null,"errorMessage":"failed to parse auto-backup file: %s","messagePattern":"failed to parse auto-backup file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/rqlited/main.go","lineNumber":318,"sourceCode":"\t}\n\n\tstopProfile()\n\tlog.Println(\"rqlite server stopped\")\n}\n\nfunc startAutoBackups(ctx context.Context, cfg *Config, str *store.Store) (*backup.Uploader, error) {\n\tif cfg.AutoBackupFile == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tb, err := backup.ReadConfigFile(cfg.AutoBackupFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read auto-backup file: %s\", err.Error())\n\t}\n\n\tuCfg, sc, err := backup.NewStorageClient(b)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse auto-backup file: %s\", err.Error())\n\t}\n\tprovider := store.NewProvider(str, uCfg.Vacuum, !uCfg.NoCompress)\n\tu := backup.NewUploader(sc, provider, time.Duration(uCfg.Interval))\n\tu.Start(ctx, str.IsLeader)\n\treturn u, nil\n}\n\nfunc startOTLPMetrics(cfg *Config) (*otlp.Service, error) {\n\tif cfg.OTLPEndpoint == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tsrv := otlp.NewService(otlp.Config{\n\t\tEndpoint:           cfg.OTLPEndpoint,\n\t\tInterval:           cfg.OTLPMetricsInterval,\n\t\tInsecure:           cfg.OTLPInsecure,\n\t\tInsecureSkipVerify: cfg.OTLPNoVerify,\n\t\tCACertFile:         cfg.OTLPCACert,","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/cmd/rqlited/main.go#L300-L336","documentation":"After the auto-backup file is read, startAutoBackups() parses it with backup.NewStorageClient(), which validates the JSON config and builds the storage client (S3, GCS, MinIO, local). Invalid JSON, unknown/missing required fields (e.g. no storage type, bad region/bucket, bad interval) produce \"failed to parse auto-backup file: <err>\" and rqlited exits.","triggerScenarios":"`rqlited -autobackup backup.json` where backup.json contains malformed JSON, an unrecognized \"storage\" type, missing required keys (bucket, path, region), or values of wrong type.","commonSituations":"Hand-edited JSON with a trailing comma; copying an example config from docs for a different storage backend; config generated by an older rqlite version using fields renamed in the current version; JSON written without a final newline by a broken templating step (usually fine) but truncation by a failed upload is not.","solutions":["Validate the JSON with `jq . backup.json` and fix syntax errors","Compare against the auto-backup schema in the rqlite docs; ensure \"storage\" type and its required fields (bucket, path, region, etc.) are present and spelled correctly","Regenerate the config using a current-version example, since field names can change between rqlite versions"],"exampleFix":"// before (backup.json)\n{\"version\": 1, \"storage\": {\"type\": \"s3\", \"bucket\": \"mybucket\"}}\n// after\n{\"version\": 1, \"storage\": {\"type\": \"s3\", \"bucket\": \"mybucket\", \"path\": \"rqlite\", \"region\": \"us-east-1\", \"access_key_id\": \"...\", \"secret_access_key\": \"...\"}}","handlingStrategy":"validation","validationCode":"# before launching rqlited with -autobackup\nif [ -n \"$AUTOBACKUP_FILE\" ]; then\n  jq -e '.version and .storage.type and (.storage.type | IN(\"s3\",\"s3-compat\",\"gcs\",\"azure\",\"local\"))' \"$AUTOBACKUP_FILE\" >/dev/null \\\n    || { echo \"error: $AUTOBACKUP_FILE is not valid auto-backup config\" >&2; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always lint auto-backup JSON with jq or a JSON schema before deployment","Keep storage credentials/type fields matching the current rqlite docs version","Store the config in version control and validate it in CI"],"tags":["configuration","backup","json","parsing"],"backgroundTag":"invalid-config-file","analyzedSha":"7586a4d1bdbd9a5a80021664c5a863cd850adb60","analyzedAt":"2026-09-03T07:03:02.260Z","contentChangedAt":"2026-09-03T07:03:02.260Z","schemaVersion":2},"datasetVersion":"2026-09-10T12:17:11.382Z"}