affaan-m/ECC · error
Nasiko install directory must be an absolute path.
Error message
Nasiko install directory must be an absolute path.
What it means
validateInstallDirectory rejects any install directory that is not a non-empty string, contains a NUL byte, or is not an absolute path (per path.isAbsolute). Relative paths cannot be safely resolved across callers, and NUL bytes are invalid in filesystem paths, so the library fails fast.
Solutions
- Pass an absolute path (e.g. /home/user/.local/bin or C:\\Users\\me\\nasiko\\bin).
- Expand environment variables/tilde in the shell before passing: --dir "$HOME/.local/bin".
- Fix the config file so the stored path is absolute.
- For programmatic use, resolve first: path.resolve(relativeDir) before calling.
Example fix
// before
await installDirectory({ dir: 'nasiko/bin' });
// after
const path = require('path');
await installDirectory({ dir: path.resolve(process.env.HOME, '.local', 'bin') }); Defensive patterns
Strategy: validation
Validate before calling
function assertAbsoluteInstallDir(d) { if (typeof d !== 'string' || !d || d.includes('\0') || !path.isAbsolute(d)) throw new Error('Install dir must be a non-empty absolute path without NUL bytes.'); } Type guard
const isAbsoluteInstallDir = (d) => typeof d === 'string' && d.length > 0 && !d.includes('\0') && path.isAbsolute(d); Try / catch
try { await installDirectory({ dir }); } catch (err) { if (err.message.includes('must be an absolute path')) throw new Error('Fix --dir: pass an absolute path, got: ' + dir); throw err; } Prevention
- Expand $HOME/tilde in shell before passing directory flags
- Store absolute paths in config files
- Resolve programmatically with path.resolve() before calling
- Validate CLI input in your wrapper before delegating
When it happens
Trigger: Calling installDirectory, parseMutationArguments, candidate, or parseStatusArguments with a --dir/install-dir value that is relative (e.g. 'nasiko/bin'), empty, not a string, or contains a NUL byte.
Common situations: Typing a relative path in the CLI; a config file storing the directory without a leading slash/drive letter; shell expansion failing so '$HOME/.local/bin' stays literal; programmatic callers passing undefined.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- --config-dir must be an existing absolute directory.
- --cwd must be an absolute path.
- --cwd must not contain a NUL byte.
- must be an absolute path explicitly configured by the…
- all overlays must be readable local files
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/64352ccd4ae4cdfc.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/nasiko-release.js:170
});
response.on('end', () => resolve(Buffer.concat(chunks)));
response.on('error', reject);
});
request.setTimeout(options.timeoutMs || 15000, () => request.destroy(new Error('Nasiko registry request timed out.')));
request.on('error', reject);
});
}
function defaultInstallDirectory(normalized, environment = process.env, homeDirectory = os.homedir()) {
if (normalized.os === 'windows') {
if (!environment.LOCALAPPDATA) throw new Error('LOCALAPPDATA is required on Windows.');
return path.join(environment.LOCALAPPDATA, 'nasiko', 'bin');
}
return path.join(homeDirectory, '.local', 'bin');
}
function validateInstallDirectory(directory) {
if (typeof directory !== 'string' || directory.includes('\0') || !path.isAbsolute(directory)) throw new Error('Nasiko install directory must be an absolute path.');
if (/^(?:\\\\|\\\\\?\\|\\\\\.\\)/.test(directory)) throw new Error('Nasiko install directory must be on a local filesystem.');
const resolved = path.resolve(directory);
if (resolved === path.parse(resolved).root) throw new Error('Nasiko cannot install directly into a filesystem root.');
let ancestor = resolved;
while (!fs.existsSync(ancestor)) {
const parent = path.dirname(ancestor);
if (parent === ancestor) throw new Error('Nasiko install directory has no resolvable filesystem ancestor.');
ancestor = parent;
}
const canonical = fs.realpathSync(ancestor);
return path.join(canonical, path.relative(ancestor, resolved));
}
function assertPrivateInstallDirectory(directory) {
const stats = fs.lstatSync(directory);
if (!stats.isDirectory() || stats.isSymbolicLink()) throw new Error('Nasiko install directory must be a real directory, not a symlink.');
if (process.platform !== 'win32') {
if (typeof process.getuid === 'function' && stats.uid !== process.getuid()) throw new Error('Nasiko install directory must be owned by the current user.');View on GitHub (pinned to 8321021c54)