{"record":{"id":"49505c0835318272","repo":"vitest-dev/vitest","slug":"unexpected-file-type-file","errorCode":null,"errorMessage":"Unexpected file type: ${file}","messagePattern":"Unexpected file type: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/projects/resolveProjects.ts","lineNumber":1211,"sourceCode":"            )\n          }\n\n          projectsConfigFiles.push(file)\n        }\n        // user can specify a directory that should be used as a project\n        else if (stats.isDirectory()) {\n          const configFile = resolveDirectoryConfig(file)\n          if (configFile) {\n            projectsConfigFiles.push(configFile)\n          }\n          else {\n            const directory = file.at(-1) === '/' ? file : `${file}/`\n            nonConfigProjectDirectories.push(directory)\n          }\n        }\n        else {\n          // should never happen\n          throw new TypeError(`Unexpected file type: ${file}`)\n        }\n      }\n      // if the string is a glob pattern, resolve it later\n      // ['./packages/*']\n      else {\n        projectsGlobMatches.push(stringOption)\n      }\n    }\n    // if the config is inlined, we can resolve it immediately\n    else if (typeof definition === 'function') {\n      projectsOptions.push(await definition({\n        command: 'serve',\n        mode: parentViteConfig.mode,\n        isPreview: false,\n        isSsrBuild: false,\n      }))\n    }\n    // the config is an object or a Promise that returns an object","sourceCodeStart":1193,"sourceCodeEnd":1229,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/projects/resolveProjects.ts#L1193-L1229","documentation":"After resolving a `projects` string entry, `statSync(file)` returned a stats object that is neither a regular file nor a directory (e.g. a FIFO, socket, character/block device, or broken symlink). The source marks this branch `// should never happen` for normal filesystem usage, so hitting it usually indicates an unusual entry in the project tree.","triggerScenarios":"A `projects` string resolves to a special filesystem object where `stats.isFile()` and `stats.isDirectory()` are both false.","commonSituations":"Stray named pipe/socket left in the repo; broken symlink; exotic/filesystem (FUSE) reporting odd stat results.","solutions":["Inspect the offending path with `ls -l` / `stat` and identify what type it is.","Remove or replace the special file with a real config file or directory.","If it reproduces on a normal file, file a Vitest issue with the stat details."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { statSync } from 'node:fs'\nfunction assertProjectsEntryIsFileOrDir(file: string) {\n  const s = statSync(file)\n  if (!s.isFile() && !s.isDirectory()) {\n    throw new Error(`projects entry '${file}' is neither a file nor a directory (got mode ${s.mode.toString(8)}). Remove the special file.`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the project tree free of sockets/pipes/devices.","Run `git status` / `ls -l` on suspect paths when this fires."],"tags":["filesystem","edge-case"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}