paperclipai/paperclip · error · Error

Refusing an unrecognized local provider smoke root

Error message

Refusing an unrecognized local provider smoke root

What it means

The script creates its scratch directory with mkdtemp using the prefix `paperclip-local-provider-smoke-` inside the OS temp dir, then asserts the generated basename still carries that prefix before creating subdirectories. If the basename check fails, an internal invariant is broken and it throws this defensive error. Normally unreachable; it guards against platform/mkdtemp behavior changes.

Source

Thrown at packages/paperclip-runner/scripts/run-local-provider-smoke.mjs:186

    ...typescriptSources,
  ],
  requiredArtifacts.filter((artifact) => artifact !== runnerd),
);
const rustSources = await filesUnder(
  resolve(packageRoot, "runner"),
  (path) =>
    path.endsWith(".rs") ||
    path.endsWith("Cargo.toml") ||
    path.endsWith("Cargo.lock"),
  (path) => /\/(?:target|tests|benches|examples)$/u.test(path),
);
await assertArtifactsFresh("runnerd", rustSources, [runnerd]);

const smokeRoot = await mkdtemp(
  join(tmpdir(), "paperclip-local-provider-smoke-"),
);
if (!basename(smokeRoot).startsWith("paperclip-local-provider-smoke-")) {
  throw new Error("Refusing an unrecognized local provider smoke root");
}
await Promise.all(
  ["tmp", "home", "paperclip-home", "codex-home", "claude-home"].map(
    (directory) => mkdir(join(smokeRoot, directory), { recursive: true }),
  ),
);

const ambientEnvironment = { ...process.env };
for (const name of Object.keys(process.env)) delete process.env[name];
for (const name of [
  "PATH",
  "SystemRoot",
  "ComSpec",
  "PATHEXT",
  "LANG",
  "LC_ALL",
  "LC_CTYPE",
  "TZ",

View on GitHub (pinned to 01ad858492)

Solutions

  1. Confirm the mkdtemp template string still starts with `paperclip-local-provider-smoke-` and matches the basename check.
  2. Retry in a normal environment; if reproducible, inspect any fs mocking or TMPDIR overrides in play.
  3. Report as a bug if it occurs on an unmodified checkout.
Defensive patterns

Strategy: try-catch

Try / catch

try { await runSmoke(); } catch (e) { if (e.message.includes('unrecognized local provider smoke root')) console.error('mkdtemp prefix invariant broken; report bug'); else throw e; }

Prevention

When it happens

Trigger: Practically never from user input: only if mkdtemp returns a name without the requested prefix (unusual tmpdir behavior, mocked fs, or the script was modified to use a different prefix/template).

Common situations: Custom test harnesses or patched environments stubbing fs.mkdtemp, or contributors editing the mkdtemp template without updating the guard.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/1adc4e3c9e24e8a2. Report an issue: GitHub.