{"record":{"id":"64642923e9d66e7c","repo":"affaan-m/ECC","slug":"ecc-nasiko-cli-executable-must-be-an-absolute-path","errorCode":null,"errorMessage":"ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.","messagePattern":"ECC_NASIKO_CLI_EXECUTABLE must be an absolute path\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/nasiko.js","lineNumber":75,"sourceCode":"function defaultExecutablePath() {\n  const normalized = normalizePlatform();\n  if (normalized.os === 'windows') {\n    return process.env.LOCALAPPDATA\n      ? path.join(process.env.LOCALAPPDATA, 'nasiko', 'bin', normalized.binaryName)\n      : null;\n  }\n  return path.join(os.homedir(), '.local', 'bin', normalized.binaryName);\n}\n\nfunction resolveExecutable(options = {}) {\n  const configured = process.env.ECC_NASIKO_CLI_EXECUTABLE;\n  const normalized = normalizePlatform();\n  const candidate = options.installDir\n    ? path.join(validateInstallDirectory(options.installDir), normalized.binaryName)\n    : configured || defaultExecutablePath();\n  if (!candidate) return null;\n  if (!path.isAbsolute(candidate)) {\n    throw new Error('ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.');\n  }\n  return candidate;\n}\n\nfunction readStatus(options = {}) {\n  const executable = resolveExecutable(options);\n  if (!executable) return { installed: false, qualified: false, version: null, executable: null };\n  return inspectInstalledNasiko(executable);\n}\n\nfunction parseStatusArguments(argumentsList) {\n  let options = { installDir: undefined, json: false };\n  for (let index = 0; index < argumentsList.length; index += 1) {\n    const argument = argumentsList[index];\n    if (argument === '--json') options = { ...options, json: true };\n    else if (argument === '--install-dir') {\n      const value = argumentsList[index + 1];\n      if (!value || value.startsWith('--')) throw new Error('Missing value for --install-dir.');","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/nasiko.js#L57-L93","documentation":"resolveExecutable builds the path to the Nasiko CLI binary. When the ECC_NASIKO_CLI_EXECUTABLE environment variable (or a configured candidate) is a relative path, the script refuses to proceed because relative executable paths resolve unpredictably against the process CWD. It throws to force an unambiguous absolute path.","triggerScenarios":"Setting ECC_NASIKO_CLI_EXECUTABLE to a relative value like './bin/nasiko' or 'nasiko-cli' (something not found on PATH via defaultExecutablePath), then calling readStatus/readInstall/uninstall which call resolveExecutable.","commonSituations":"Configuring the env var in .envrc or CI with a shell-relative path; assuming the script resolves paths against the repo root; moving a binary and updating the env var with a shortcut like '~/bin/nasiko' typoed as a relative fragment.","solutions":["Set ECC_NASIKO_CLI_EXECUTABLE to a fully absolute path, e.g. /usr/local/bin/nasiko.","Expand ~ and $HOME in your shell config before exporting: export ECC_NASIKO_CLI_EXECUTABLE=\"$HOME/bin/nasiko\".","Alternatively unset the env var so the script falls back to defaultExecutablePath().","Use `readlink -f \"$(which nasiko)\"` to obtain an absolute path."],"exampleFix":"// before\nexport ECC_NASIKO_CLI_EXECUTABLE=./dist/nasiko\n// after\nexport ECC_NASIKO_CLI_EXECUTABLE=\"$PWD/dist/nasiko\"","handlingStrategy":"validation","validationCode":"const exe = process.env.ECC_NASIKO_CLI_EXECUTABLE;\nif (exe && !require('path').isAbsolute(exe)) throw new Error(`Set ECC_NASIKO_CLI_EXECUTABLE to an absolute path, got: ${exe}`);","typeGuard":"const isAbsoluteExecPath = (v) => typeof v === 'string' && v.length > 0 && require('path').isAbsolute(v);","tryCatchPattern":"try {\n  readStatus();\n} catch (err) {\n  if (err.message.includes('must be an absolute path')) {\n    console.error('Fix ECC_NASIKO_CLI_EXECUTABLE: use path.resolve()/an absolute path.');\n  } else throw err;\n}","preventionTips":["Export ECC_NASIKO_CLI_EXECUTABLE with $HOME or absolute paths only, never ./relative.","Run `readlink -f $(which nasiko)` when generating the value.","Keep the env var in one shared env file so it is defined consistently.","Prefer unsetting the var and letting the script's default lookup work when unsure."],"tags":["cli","environment","path-validation"],"backgroundTag":"invalid-env-var-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}