santifer/career-ops · error

: refusing

Error message

${LOCAL_PATHS_FILE}: refusing "${path}" — ${why}

What it means

localUserPaths reads the gitignored local-paths declaration file (LOCAL_PATHS_FILE) which lets an install redirect user-layer directories. The reject helper throws when a declared path is unsafe or self-contradictory — for example, when the declaration file lists itself, which is impossible to honor because the file is gitignored and would never be updated by the updater. The message includes the offending path and the reason.

Solutions

  1. Open the local-paths declaration file in the repo root and remove the entry that matches the file's own name (or fix the path flagged in the message).
  2. Keep only legitimate user-layer directories (e.g. data/, documents/, output/) in the list — never the declaration file itself.
  3. If unsure, delete the declaration file entirely: localUserPaths returns [] when it does not exist, restoring default behavior.
  4. Re-run the update command to confirm the error is gone.

Example fix

# before — .career-ops-local-paths (declaration file lists itself)
.career-ops-local-paths
data
documents

# after
data
documents
Defensive patterns

Strategy: validation

Validate before calling

const declared = parseLocalPaths(readFileSync(localPathsFile, 'utf-8'));
const self = '.career-ops-local-paths'; // LOCAL_PATHS_FILE name
if (declared.includes(self)) {
  throw new Error(`${localPathsFile} must not list itself`);
}

Type guard

function isSafeLocalPathEntry(entry, selfName) {
  return typeof entry === 'string' && entry.length > 0 && entry !== selfName;
}

Try / catch

try {
  const paths = localUserPaths(root);
} catch (err) {
  if (err.message.startsWith(LOCAL_PATHS_FILE)) {
    console.error(`Fix or delete ${join(root, LOCAL_PATHS_FILE)}: ${err.message}`);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling localUserPaths(root) (directly or via update-system apply/check) where the LOCAL_PATHS_FILE contains an entry that equals the declaration file's own name, or another rejected path (invalid/unsafe redirect target), causing the loop to call reject(path, why).

Common situations: A user edited the local-paths file to redirect output directories and accidentally added the declaration file's own name to the list; a copy-pasted example included the file itself; a typo produced a path the validator refuses.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16). Data as JSON: /api/errors/4137ee23e08f9713. Report an issue: GitHub.

Appendix: source

Thrown at update-system.mjs:563

/**
 * Read + validate the local declaration file.
 *
 * Refuses rather than honours anything ambiguous: a path the system layer
 * already ships would silently stop updating, and a path that escapes the
 * checkout would widen the "never touch" set over files the updater does not
 * own. Both throw, naming the offending entry.
 *
 * @param {string} [root=ROOT] - Repo root to read from.
 * @returns {string[]} Extra user-layer paths. Empty when the file is absent.
 */
export function localUserPaths(root = ROOT) {
  const file = join(root, LOCAL_PATHS_FILE);
  if (!existsSync(file)) return [];

  const declared = parseLocalPaths(readFileSync(file, 'utf-8'));
  const reject = (path, why) => {
    throw new Error(`${LOCAL_PATHS_FILE}: refusing "${path}" — ${why}`);
  };

  for (const path of declared) {
    if (path === LOCAL_PATHS_FILE) {
      reject(path, 'the declaration file cannot list itself (it is gitignored, so nothing updates it)');
    }
    if (path.startsWith('/') || /^[A-Za-z]:[\\/]/.test(path) || path.startsWith('\\')) {
      reject(path, 'paths must be repo-relative, not absolute');
    }
    if (path.split(/[\\/]/).includes('..')) {
      reject(path, 'paths must stay inside the repo');
    }
    // Canonical spelling, required BEFORE the collision check below.
    //
    // That check compares strings exactly (`path === sys`), and
    // userLayerViolations() later compares against git's changed-path format,
    // which is always canonical. A non-canonical spelling therefore matches
    // NEITHER: `./merge-tracker.mjs` sails past the collision check, and is

View on GitHub (pinned to e7abd431fc)