{"record":{"id":"30f26160e7c263fb","repo":"earendil-works/pi","slug":"invalid","errorCode":"invalid","errorMessage":"Unsupported file type","messagePattern":"Unsupported file type","errorType":"error_code","errorClass":"FileError","httpStatus":null,"severity":"error","filePath":"packages/agent/src/harness/env/nodejs.ts","lineNumber":83,"sourceCode":"}\n\nfunction fileKindFromStats(stats: {\n\tisFile(): boolean;\n\tisDirectory(): boolean;\n\tisSymbolicLink(): boolean;\n}): FileKind | undefined {\n\tif (stats.isFile()) return \"file\";\n\tif (stats.isDirectory()) return \"directory\";\n\tif (stats.isSymbolicLink()) return \"symlink\";\n\treturn undefined;\n}\n\nfunction fileInfoFromStats(\n\tpath: string,\n\tstats: { isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; size: number; mtimeMs: number },\n): Result<FileInfo, FileError> {\n\tconst kind = fileKindFromStats(stats);\n\tif (!kind) return err(new FileError(\"invalid\", \"Unsupported file type\", path));\n\treturn ok({\n\t\tname: basename(path),\n\t\tpath,\n\t\tkind,\n\t\tsize: stats.size,\n\t\tmtimeMs: stats.mtimeMs,\n\t});\n}\n\nfunction isNodeError(error: unknown): error is NodeJS.ErrnoException {\n\treturn error instanceof Error && \"code\" in error;\n}\n\nfunction toFileError(error: unknown, fallbackPath?: string): FileError {\n\tif (error instanceof FileError) return error;\n\tconst cause = toError(error);\n\tconst nodeError = isNodeError(error) ? error : undefined;\n\tconst path = typeof nodeError?.path === \"string\" ? nodeError.path : fallbackPath;","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/agent/src/harness/env/nodejs.ts#L65-L101","documentation":"Returned as FileError('invalid') by fileInfoFromStats when fileKindFromStats could not classify the stat result: the entry is neither a regular file, directory, nor symlink (e.g. a socket, FIFO, or device node). FileInfo has no representation for such kinds, so directory listing/info operations skip-or-fail with this sentinel rather than mislabeling the entry.","triggerScenarios":"Thrown at packages/agent/src/harness/env/nodejs.ts:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This file type is not supported for the operation; use a supported file type."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}