{"record":{"id":"a50c1593312d37b1","repo":"stablyai/orca","slug":"verify-skills-cli-runtime-missing-runtime-import","errorCode":null,"errorMessage":"[verify-skills-cli-runtime] missing runtime import \"${specifier}\" from ${artifactPath(outDir, importer)}: ${detail}","messagePattern":"\\[verify-skills-cli-runtime\\] missing runtime import \"(.+?)\" from (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scripts/verify-skills-cli-runtime.cjs","lineNumber":93,"sourceCode":"    }\n    directory = dirname(directory)\n  }\n  return false\n}\n\nfunction resolveRuntimeImport(outDir, artifactRoot, importer, specifier) {\n  if (BUILTINS.has(specifier) || isBuiltin(specifier)) {\n    return null\n  }\n  let resolved\n  try {\n    resolved = createRequire(importer).resolve(specifier)\n  } catch (error) {\n    if (isOptionalPackageImport(artifactRoot, importer, specifier)) {\n      return null\n    }\n    const detail = error instanceof Error ? error.message : String(error)\n    throw new Error(\n      `[verify-skills-cli-runtime] missing runtime import \"${specifier}\" from ` +\n        `${artifactPath(outDir, importer)}: ${detail}`\n    )\n  }\n  if (isOutsideRoot(artifactRoot, resolved)) {\n    throw new Error(\n      `[verify-skills-cli-runtime] import \"${specifier}\" from ` +\n        `${artifactPath(outDir, importer)} resolved outside ${artifactRoot}: ${resolved}`\n    )\n  }\n  return resolved\n}\n\nfunction collectRuntimeClosure(outDir, artifactRoot = dirname(outDir)) {\n  outDir = realpathSync(outDir)\n  artifactRoot = realpathSync(artifactRoot)\n  if (isOutsideRoot(artifactRoot, outDir)) {\n    throw new Error(`[verify-skills-cli-runtime] ${outDir} is outside ${artifactRoot}`)","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/verify-skills-cli-runtime.cjs#L75-L111","documentation":"resolveRuntimeImport() uses Node's createRequire(importer).resolve(specifier) to resolve a runtime import inside the skills CLI build artifact. It throws when resolution fails for a non-builtin, non-optional specifier — meaning the built CLI references a dependency that isn't bundled and isn't resolvable from the artifact's location.","triggerScenarios":"The CLI source imports a package that wasn't added to the bundle (missing dependency in the build config); a dynamic require() to a specifier that only resolves from source, not from the published artifact; an optional dependency not declared in the optional-import allowlist; a typo'd specifier.","commonSituations":"Bundler misconfiguration excluding a needed dep; new dependency added to source but not to package.json dependencies; production prune removing a dep that the runtime requires; platform-conditional import that the verifier doesn't recognize as optional.","solutions":["Read the error's specifier and importer path, then confirm that dependency is declared in package.json and bundled.","If the import is genuinely optional at runtime, register it in isOptionalPackageImport's allowlist (the function the verifier already consults).","Rebuild the CLI artifact and re-run the verifier.","If the dep is required, add it to the bundler's externals-or-include set so it ships inside the artifact."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before invoking the verifier, statically confirm every non-builtin import in the\n// entry file is either bundled into the artifact or registered as optional:\nimport { readFileSync } from 'node:fs'\nfunction listImports(file) {\n  const src = readFileSync(file, 'utf8')\n  const re = /(?:require\\(|import\\s[^'\";]*from\\s*)['\"]([^'\"]+)['\"]/g\n  return [...src.matchAll(re)].map((m) => m[1]).filter((s) => !s.startsWith('.') && !s.startsWith('node:'))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the bundler's externals and package.json dependencies in sync: any external must be a real dependency or registered optional.","Add new runtime deps to the bundler include set in the same commit that adds the import.","Run the runtime verifier in PR CI so a missing import fails the build, not a downstream release."],"tags":["bundler","dependency","runtime","skills-cli","build-artifact"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}