{"record":{"id":"fa73599071faad33","repo":"koala73/worldmonitor","slug":"no-internal-convex-exports-found-under-convex-refusing-to","errorCode":null,"errorMessage":"No internal* Convex exports found under convex/ — refusing to proceed.","messagePattern":"No internal\\* Convex exports found under convex/ — refusing to proceed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/sync-sentry-convex-probe-filters.mjs","lineNumber":517,"sourceCode":"  if (args.help) {\n    console.log(`Usage:\n  node scripts/sync-sentry-convex-probe-filters.mjs --check\n  node scripts/sync-sentry-convex-probe-filters.mjs --write\n  node scripts/sync-sentry-convex-probe-filters.mjs --apply [--dry-run]\n\nDefault with no flags: --check`);\n    return;\n  }\n\n  const modeCount = [args.check, args.write, args.apply].filter(Boolean).length;\n  if (modeCount > 1) {\n    throw new Error('Pass only one of --check, --write, --apply');\n  }\n  const mode = args.write ? 'write' : args.apply ? 'apply' : 'check';\n\n  const patterns = expectedInternalPatternsFromSource();\n  if (patterns.length === 0) {\n    throw new Error('No internal* Convex exports found under convex/ — refusing to proceed.');\n  }\n\n  if (mode === 'write') {\n    runWrite(patterns);\n    return;\n  }\n  if (mode === 'check') {\n    runCheck(patterns);\n    return;\n  }\n  await runApply(patterns, { dryRun: Boolean(args['dry-run']) });\n}\n\nconst isMain = isMainModule(import.meta.url, process.argv[1]);\nif (isMain) {\n  main().catch((error) => {\n    console.error(\n      error instanceof Error ? error.message : String(error),","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/koala73/worldmonitor/blob/e586b8b4b80f595aa7ece295eec10d76f2921240/scripts/sync-sentry-convex-probe-filters.mjs#L499-L535","documentation":"Before doing anything, the script scans the convex/ directory with expectedInternalPatternsFromSource() to build the list of internal* Convex exports it will sync filter rules for. If that scan finds zero matching exports, the script refuses to run rather than writing an empty or wrong filter set, since its whole purpose depends on those exports existing.","triggerScenarios":"Running the script from a checkout or working directory where convex/ does not exist, is empty, or contains no files exporting symbols named internal*; running with a changed cwd so the relative convex/ path resolves elsewhere; a rename/refactor that dropped the internal prefix from all Convex exports.","commonSituations":"Running the script from a subdirectory or the repo root of a different project; sparse/partial clone without convex/; after a refactor renamed publicQuery/internalQuery exports so the pattern no longer matches; CI job checking out only a subset of paths.","solutions":["Run the script from the repository root so convex/ resolves correctly.","Verify `ls convex/` shows files and that they contain internal* exports (e.g. internalQuery, internalMutation) matching the script's source patterns.","Restore the convex/ directory if it was deleted or not checked out (git checkout / full clone).","Update expectedInternalPatternsFromSource() if the export naming convention changed legitimately, then re-run."],"exampleFix":"// before (from wrong directory)\ncd scripts && node sync-sentry-convex-probe-filters.mjs\n// after\n cd /repo-root && node scripts/sync-sentry-convex-probe-filters.mjs","handlingStrategy":"validation","validationCode":"import { existsSync, readdirSync } from 'node:fs';\nif (!existsSync('convex') || readdirSync('convex').length === 0) {\n  console.error('Run from repo root: convex/ directory is missing or empty.');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always execute the script from the repository root (use npm scripts, not raw cd).","Grep for internal exports (grep -r 'internal' convex/) before running to confirm the scan will match.","Keep the export naming convention in sync with expectedInternalPatternsFromSource() when refactoring convex/."],"tags":["cli","filesystem","guard","convex"],"backgroundTag":"empty-result-set","analyzedSha":"e586b8b4b80f595aa7ece295eec10d76f2921240","analyzedAt":"2026-09-22T01:50:49.965Z","contentChangedAt":"2026-09-22T01:50:49.965Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}