{"record":{"id":"186ad5702efed31b","repo":"docmirror/dev-sidecar","slug":"unknown-os-type-os-platform","errorCode":null,"errorMessage":"UNKNOWN OS TYPE ${os.platform()}","messagePattern":"UNKNOWN OS TYPE (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/shell/shell.js","lineNumber":147,"sourceCode":"        // log.info('cmd 命令完成：', stdout)\n        resolve(stdout.replace('Active code page: 65001\\r\\n', ''))\n      }\n      // log.info('关闭 cmd')\n      // ps.kill('SIGINT')\n    })\n  })\n}\n\nfunction getSystemShell () {\n  switch (getSystemPlatform(true)) {\n    case 'mac':\n      return DarwinSystemShell\n    case 'linux':\n      return LinuxSystemShell\n    case 'windows':\n      return WindowsSystemShell\n    default:\n      throw new Error(`UNKNOWN OS TYPE ${os.platform()}`)\n  }\n}\n\nfunction getSystemPlatform (throwIfUnknown = false) {\n  switch (os.platform()) {\n    case 'darwin':\n      return 'mac'\n    case 'linux':\n      return 'linux'\n    case 'win32':\n      return 'windows'\n    case 'win64':\n      return 'windows'\n    default:\n      log.error(`UNKNOWN OS TYPE: ${os.platform()}`)\n      if (throwIfUnknown) {\n        throw new Error(`UNKNOWN OS TYPE '${os.platform()}'`)\n      } else {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/core/src/shell/shell.js#L129-L165","documentation":"getSystemShell() maps os.platform() to a system-shell implementation (Darwin/Linux/Windows). If os.platform() returns anything other than darwin/linux/win32 (e.g. 'freebsd', 'openbsd', 'android', 'aix'), no shell implementation exists and this error is thrown immediately, so Shell.execute() cannot run any command.","triggerScenarios":"Running dev-sidecar (or calling Shell.execute/getSystemShell directly) on an OS whose os.platform() is not one of darwin|linux|win32; notably 'freebsd', 'openbsd', 'android' (Termux), or exotic platforms.","commonSituations":"Deploying the CLI to a FreeBSD server or Android/Termux environment; running in an unusual Node build (e.g. cygwin/msys reporting a non-win32 platform in some setups); CI images on unsupported platforms.","solutions":["Run dev-sidecar on a supported platform: macOS (darwin), Linux, or Windows (win32)","If on FreeBSD/OpenBSD, use a Linux VM/container or jail Linux emulation instead","Check `node -e \"console.log(process.platform)\"` to confirm the platform Node reports","Add/patch a shell implementation for the platform if you must support it (fork and extend shell.js switch)"],"exampleFix":"// before\nawait Shell.execute('ls', {}) // throws on freebsd\n// after\nconst p = os.platform()\nif (!['darwin', 'linux', 'win32'].includes(p)) {\n  throw new Error(`Unsupported platform ${p}; use macOS/Linux/Windows`)\n}\nawait Shell.execute('ls', {})","handlingStrategy":"type-guard","validationCode":"const SUPPORTED = ['darwin', 'linux', 'win32']\nif (!SUPPORTED.includes(os.platform())) {\n  throw new Error(`Unsupported platform: ${os.platform()}. Use macOS/Linux/Windows.`)\n}","typeGuard":"function isSupportedPlatform(p = os.platform()) { return ['darwin', 'linux', 'win32'].includes(p) }","tryCatchPattern":"try {\n  await Shell.execute(cmd, opts)\n} catch (e) {\n  if (String(e.message).startsWith('UNKNOWN OS TYPE')) {\n    log.error('Shell commands unavailable on this platform')\n    return null\n  }\n  throw e\n}","preventionTips":["Check `process.platform` before deploying to servers/CI","Use Linux containers or VMs for non-supported platforms (FreeBSD, Termux)","Avoid exotic Node builds that report unusual platforms","Document platform requirements in deployment scripts"],"tags":["platform","operating-system","unsupported-platform"],"backgroundTag":"unsupported-os-platform","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}