{"record":{"id":"8967d382f44cf24e","repo":"syncthing/syncthing","slug":"not-found-folder-file-not-in-database","errorCode":null,"errorMessage":"not found (folder/file not in database)","messagePattern":"not found \\(folder/file not in database\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/syncthing/cli/utils.go","lineNumber":52,"sourceCode":"\t}\n\t_, err = client.Post(url, \"\")\n\treturn err\n}\n\nfunc indexDumpOutputWrapper(apiClientFactory *apiClientFactory) func(url string) error {\n\treturn func(url string) error {\n\t\treturn indexDumpOutput(url, apiClientFactory)\n\t}\n}\n\nfunc indexDumpOutput(url string, apiClientFactory *apiClientFactory) error {\n\tclient, err := apiClientFactory.getClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tresponse, err := client.Get(url)\n\tif errors.Is(err, errNotFound) {\n\t\treturn errors.New(\"not found (folder/file not in database)\")\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn prettyPrintResponse(response)\n}\n\nfunc saveToFile(url string, apiClientFactory *apiClientFactory) error {\n\tclient, err := apiClientFactory.getClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tresponse, err := client.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, params, err := mime.ParseMediaType(response.Header.Get(\"Content-Disposition\"))\n\tif err != nil {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/syncthing/syncthing/blob/058bcd7334839663cf569501d3ac539034d45cb5/cmd/syncthing/cli/utils.go#L34-L70","documentation":"Produced by the CLI's indexDumpOutput when the db endpoint GET returns 404 (mapped from errNotFound). It means the REST call succeeded but the daemon has no database entry for the requested folder ID (db/status) or folder/file path (db/file).","triggerScenarios":"'syncthing cli show index db/status <folderID>' or 'db/file <folderID> <path>' where the folder ID is not in the daemon's config, the folder exists but was never scanned into the database, or the file path does not match any indexed item.","commonSituations":"Folder ID typo (case-sensitive); folder just added and not yet scanned; querying db/file with a path relative to the wrong root; querying a paused/unshared folder with an empty index.","solutions":["List actual folder IDs: syncthing cli config folders","Trigger a rescan and retry: syncthing cli operations scan <folderID>","For db/file, pass the path relative to the folder root exactly as stored (case-sensitive on Linux)","Confirm the folder is shared and has synced at least once (syncthing cli show index db/status)"],"exampleFix":"# before\nsyncthing cli show index db/file documents /home/user/Documents/report.txt\n# -> not found (folder/file not in database)\n\n# after: path relative to folder root\nsyncthing cli show index db/file documents report.txt","handlingStrategy":"validation","validationCode":"// verify the folder exists before dumping its index\nfolders, err := client.GetJSON(\"rest/config/folders\")\nif !folderExists(folders, folderID) {\n    return fmt.Errorf(\"unknown folder %q; run 'syncthing cli config folders'\", folderID)\n}","typeGuard":null,"tryCatchPattern":"err := indexDumpOutput(url, factory)\nif errors.Is(err, errNotFound) || strings.Contains(err.Error(), \"not found (folder/file not in database)\") {\n    // wrong ID or path: list folders / rescan, do not retry unchanged\n}","preventionTips":["Always enumerate valid folder IDs from config instead of guessing","Rescan newly added folders before querying db/file","Pass file paths relative to the folder root, matching the OS case sensitivity"],"tags":["cli","api","database","folders"],"backgroundTag":null,"analyzedSha":"058bcd7334839663cf569501d3ac539034d45cb5","analyzedAt":"2026-08-15T07:53:43.174Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}