{"record":{"id":"50ffb579a6546173","repo":"angular/angular-cli","slug":"unknown-shell-environment-variable-value-she","errorCode":null,"errorMessage":"Unknown `$SHELL` environment variable value (${shell}). Angular CLI autocompletion only supports Bash or Zsh.","messagePattern":"Unknown `\\$SHELL` environment variable value \\((.+?)\\)\\. Angular CLI autocompletion only supports Bash or Zsh\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/utilities/completion.ts","lineNumber":225,"sourceCode":"    throw new Error(\n      '`$SHELL` environment variable not set. Angular CLI autocompletion only supports Bash or' +\n        \" Zsh. If you're on Windows, Cmd and Powershell don't support command autocompletion,\" +\n        ' but Git Bash or Windows Subsystem for Linux should work, so please try again in one of' +\n        ' those environments.',\n    );\n  }\n  const home = env['HOME'];\n  if (!home) {\n    throw new Error(\n      '`$HOME` environment variable not set. Setting up autocompletion modifies configuration files' +\n        ' in the home directory and must be set.',\n    );\n  }\n\n  // Get all the files we can add `ng completion` to which apply to the user's `$SHELL`.\n  const runCommandCandidates = getShellRunCommandCandidates(shell, home);\n  if (!runCommandCandidates) {\n    throw new Error(\n      `Unknown \\`$SHELL\\` environment variable value (${shell}). Angular CLI autocompletion only supports Bash or Zsh.`,\n    );\n  }\n\n  // Get the first file that already exists or fallback to a new file of the first candidate.\n  const candidates = await Promise.allSettled(\n    runCommandCandidates.map((rcFile) => fs.access(rcFile).then(() => rcFile)),\n  );\n  const rcFile =\n    candidates.find(\n      (result): result is PromiseFulfilledResult<string> => result.status === 'fulfilled',\n    )?.value ?? runCommandCandidates[0];\n\n  // Append Angular autocompletion setup to RC file.\n  try {\n    await fs.appendFile(\n      rcFile,\n      '\\n\\n# Load Angular CLI autocompletion.\\nsource <(ng completion script)\\n',","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/utilities/completion.ts#L207-L243","documentation":"`initializeAutocomplete` passes the `$SHELL` value to `getShellRunCommandCandidates`, which only recognizes shells whose run commands/RC files it knows (Bash and Zsh). If `$SHELL` points to any other shell (fish, csh, nushell, etc.) no candidates are returned and the CLI throws this error since it cannot safely generate completion config for unknown shells.","triggerScenarios":"Running `ng completion` (via `run`/`considerSettingUpAutocompletion`) with `$SHELL` set to a non-Bash/Zsh shell path, e.g. `/usr/bin/fish`, `/bin/tcsh`, or `/usr/bin/nu`.","commonSituations":"Developers using fish or nushell as their login shell; macOS/Linux users with exotic shells; containers defaulting to dash/sh whose `$SHELL` is not bash/zsh.","solutions":["Switch to Bash or Zsh and re-run (e.g. `chsh -s /bin/bash`, then open a new terminal).","Temporarily override: `SHELL=/bin/bash ng completion` to write completion setup into your Bash RC.","Set up completion manually for your shell if it supports ng's completion script, or use shell-specific community completions.","Keep `$SHELL` set to bash/zsh for the duration of the command even if your interactive shell is different."],"exampleFix":"// before\nfish -c 'ng completion'   # SHELL=/usr/bin/fish -> throws\n// after\nSHELL=/bin/bash ng completion","handlingStrategy":"validation","validationCode":"const shell = process.env.SHELL ?? '';\nconst supported = ['/bash', '/zsh'].some(s => shell.endsWith(s));\nif (shell && !supported) {\n  console.warn(`ng completion does not support $SHELL=${shell}; use bash or zsh.`);\n}","typeGuard":"function isSupportedShell(shell: string | undefined): shell is string {\n  return typeof shell === 'string' && /\\/(ba)?sh$|\\/zsh$/.test(shell);\n}","tryCatchPattern":"try {\n  await ngCompletionSetup();\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unknown `$SHELL` environment variable value')) {\n    // re-run under bash/zsh or configure completion manually\n  } else { throw e; }\n}","preventionTips":["Check `echo $SHELL` before running completion setup.","Use `SHELL=/bin/bash ng completion` to target bash RC files from another shell.","Switch login shell with chsh to bash/zsh if you want first-class support.","Consult the CLI docs for the supported-shell list before automating setup."],"tags":["shell","autocompletion","unsupported-shell","angular-cli"],"backgroundTag":"unsupported-shell","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}