{"record":{"id":"7a2199b9b8364185","repo":"denoland/deno","slug":"not-supported","errorCode":null,"errorMessage":"not supported","messagePattern":"not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ext/io/fs.rs","lineNumber":72,"sourceCode":"\nimpl std::error::Error for FsError {}\n\nimpl FsError {\n  pub fn kind(&self) -> io::ErrorKind {\n    match self {\n      Self::Io(err) => err.kind(),\n      Self::FileBusy => io::ErrorKind::Other,\n      Self::NotSupported => io::ErrorKind::Other,\n      Self::PermissionCheck(e) => e.kind(),\n      Self::JoinError(_) => io::ErrorKind::Other,\n    }\n  }\n\n  pub fn into_io_error(self) -> io::Error {\n    match self {\n      FsError::Io(err) => err,\n      FsError::FileBusy => io::Error::new(self.kind(), \"file busy\"),\n      FsError::NotSupported => io::Error::new(self.kind(), \"not supported\"),\n      FsError::PermissionCheck(err) => err.into_io_error(),\n      FsError::JoinError(ref err) => {\n        io::Error::new(self.kind(), format!(\"join error: {err}\"))\n      }\n    }\n  }\n}\n\nimpl From<io::Error> for FsError {\n  fn from(err: io::Error) -> Self {\n    Self::Io(err)\n  }\n}\n\nimpl From<io::ErrorKind> for FsError {\n  fn from(err: io::ErrorKind) -> Self {\n    Self::Io(err.into())\n  }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/io/fs.rs#L54-L90","documentation":"FsError::NotSupported (JS error class 'not_supported', a TypeError, message 'not supported'; ext/io/fs.rs:72) is returned when the concrete file resource cannot perform the requested operation: reads (read/readAll) against stdout/stderr resources, and File-trait operations on unsupported platforms — for example chown on Windows (implemented only for unix) and stat on targets that are neither unix nor windows.","triggerScenarios":"Reading from a stdout/stderr resource (iterating Deno.stdout.readable, or any API that calls read on the stdout/stderr rid); calling file-chown operations on a Windows handle; hitting the non-unix/non-windows cfg arms of the stdio File implementation.","commonSituations":"Trying to 'capture' output by reading Deno.stdout.readable instead of piping a child process; scripts assuming Unix semantics for ownership ops; code that treats every rid as a general-purpose file.","solutions":["Never read stdout/stderr — capture output by spawning with Deno.Command and stdout: 'piped'","Gate ownership ops on the platform: only call chown when Deno.build.os !== 'windows'","Feature-check with a benign operation before relying on platform-specific file ops"],"exampleFix":"// before\nfor await (const chunk of Deno.stdout.readable) { /* ... */ }\n// TypeError: not supported\n\n// after\nconst cmd = new Deno.Command(Deno.execPath(), {\n  args: ['run', 'child.ts'],\n  stdout: 'piped',\n});\nconst { stdout } = await cmd.output();","handlingStrategy":"type-guard","validationCode":"const isWritableStdio = (rid: number): boolean =>\n  rid === Deno.stdout.rid || rid === Deno.stderr.rid;\n\nasync function readResource(rid: number, buf: Uint8Array): Promise<number | null> {\n  if (isWritableStdio(rid)) {\n    throw new Error(`rid ${rid} is stdout/stderr and cannot be read; pipe a child process instead`);\n  }\n  // proceed with a read on a readable resource\n  return readViaApi(rid, buf);\n}","typeGuard":"function isReadableStreamLike(f: Deno.FsFile | Deno.File): boolean {\n  return ![Deno.stdout.rid, Deno.stderr.rid].includes(f.rid);\n}\n\nconst chownSupported = (): boolean => Deno.build.os !== 'windows';","tryCatchPattern":"try {\n  await file.chown(uid, gid);\n} catch (e) {\n  if (e instanceof TypeError && /not supported/i.test(e.message)) {\n    console.warn('chown is unavailable on this platform');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Never read stdout/stderr; capture child output with Deno.Command and stdout: 'piped'","Gate platform-specific ops (chown) on Deno.build.os before calling","Probe unsupported capabilities with a cheap guarded call at startup"],"tags":["filesystem","stdio","platform-support","not-supported","deno"],"backgroundTag":"operation-not-supported","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}