{"record":{"id":"eab8978a7bccb1e5","repo":"syncthing/syncthing","slug":"file-system-type-s-not-recognized","errorCode":null,"errorMessage":"File system type '%s' not recognized","messagePattern":"File system type '(.+?)' not recognized","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/fs/filesystem.go","lineNumber":246,"sourceCode":"\t\tcase *optionMtime:\n\t\t\tmtimeOpt = opt\n\t\tdefault:\n\t\t\topts[i] = opt\n\t\t\ti++\n\t\t}\n\t}\n\topts = opts[:i]\n\n\t// Construct file system using the registered factory function\n\tvar fs Filesystem\n\tvar err error\n\tfilesystemFactoriesMutex.Lock()\n\tfsFactory, factoryFound := filesystemFactories[fsType]\n\tfilesystemFactoriesMutex.Unlock()\n\tif factoryFound {\n\t\tfs, err = fsFactory(uri, opts...)\n\t} else {\n\t\terr = fmt.Errorf(\"File system type '%s' not recognized\", fsType)\n\t}\n\n\tif err != nil {\n\t\tfs = &errorFilesystem{\n\t\t\tfsType: fsType,\n\t\t\turi:    uri,\n\t\t\terr:    err,\n\t\t}\n\t}\n\n\t// mtime handling should happen inside walking, as filesystem calls while\n\t// walking should be mtime-resolved too\n\tif mtimeOpt != nil {\n\t\tfs = mtimeOpt.apply(fs)\n\t}\n\n\tfs = &metricsFS{next: fs}\n","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/syncthing/syncthing/blob/058bcd7334839663cf569501d3ac539034d45cb5/lib/fs/filesystem.go#L228-L264","documentation":"fs.NewFilesystem was called with an fsType that has no registered factory, so a filesystem could not be constructed. Instead of returning a bare error, the library returns an errorFilesystem that fails on every subsequent operation with the same error — the failure surfaces later, at first use.","triggerScenarios":"NewFilesystem with a misspelled or unregistered type string (e.g. 'basicc' instead of 'basic', or a type only available on other platforms, like 'fake' outside tests). The returned errorFilesystem yields this error on any Open/Stat/Create call.","commonSituations":"Downgrading/upgrading Syncthing where a folder config references an fs type no longer compiled in; typos in programmatic config; custom builds without certain backends.","solutions":["Correct the filesystem type in the configuration; supported values are the fs.FilesystemType constants (basic, fake, walkfs, ...) — check the registry via the registered factories.","If the type should exist, verify the build includes the package that registers it (import side effects).","Handle errors on first use of the filesystem: errors.Is(err, ErrRecursive ...) / inspect errorFilesystem behavior rather than assuming NewFilesystem fails eagerly."],"exampleFix":"// before\nf := fs.NewFilesystem(fs.FilesystemType(\"basik\"), uri)\n// after\nf := fs.NewFilesystem(fs.FilesystemTypeBasic, uri)","handlingStrategy":"validation","validationCode":"validTypes := map[fs.FilesystemType]bool{fs.FilesystemTypeBasic: true /*, ...*/}\nif !validTypes[fsType] { return nil, fmt.Errorf(\"unknown fs type %s\", fsType) }","typeGuard":null,"tryCatchPattern":"f := fs.NewFilesystem(fsType, uri)\nif _, err := f.Lstat(\".\"); err != nil {\n    // errorFilesystem surfaces the construction error here\n    return fmt.Errorf(\"filesystem %s unusable: %w\", fsType, err)\n}","preventionTips":["Always construct types via fs.FilesystemType* constants, never string literals.","Exercise the filesystem once (Lstat \".\") right after creation to fail fast on errorFilesystem."],"tags":["configuration","factory","filesystem"],"backgroundTag":null,"analyzedSha":"058bcd7334839663cf569501d3ac539034d45cb5","analyzedAt":"2026-08-15T07:53:43.174Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}