{"record":{"id":"db9072112858f044","repo":"parcel-bundler/parcel","slug":"path-relative-process-cwd-source-does-not-e","errorCode":null,"errorMessage":"${path.relative(process.cwd(), source)} does not exist.","messagePattern":"(.+?) does not exist\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/requests/EntryRequest.js","lineNumber":109,"sourceCode":"  relativeSource: FilePath,\n  pkgFilePath: FilePath,\n  keyPath: string,\n  options: ParcelOptions,\n) {\n  let source = path.join(entry, relativeSource);\n  let stat;\n  try {\n    stat = await fs.stat(source);\n  } catch (err) {\n    let contents = await fs.readFile(pkgFilePath, 'utf8');\n    let alternatives = await findAlternativeFiles(\n      fs,\n      relativeSource,\n      entry,\n      options.projectRoot,\n      false,\n    );\n    throw new ThrowableDiagnostic({\n      diagnostic: {\n        origin: '@parcel/core',\n        message: md`${path.relative(process.cwd(), source)} does not exist.`,\n        codeFrames: [\n          {\n            filePath: pkgFilePath,\n            codeHighlights: generateJSONCodeHighlights(contents, [\n              {\n                key: keyPath,\n                type: 'value',\n              },\n            ]),\n          },\n        ],\n        hints: alternatives.map(r => {\n          return md`Did you mean '__${r}__'?`;\n        }),\n      },","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/requests/EntryRequest.js#L91-L127","documentation":"Thrown by assertFile() when fs.stat(source) rejects — the file path referenced by the source field in package.json (or a target's source) does not exist on disk. Parcel produces a ThrowableDiagnostic with a code frame pointing at the offending value in package.json and suggests likely alternative filenames.","triggerScenarios":"Called from resolveEntry() while validating each relativeSource from pkg.source (or pkg.targets[*].source). The joined path path.join(entry, relativeSource) fails stat(). This fires for non-glob source strings; globs are expanded separately.","commonSituations":"Renaming or moving an entry file without updating package.json source; typo in the source path; case-sensitivity mismatch on Linux after committing from macOS/Windows; deleting the entry file but leaving package.json pointing at it; source field pointing to a file in a subdirectory that was never created.","solutions":["Check the file path in package.json source / targets.*.source — verify it exists with ls.","If you renamed the file, update the source field to match the new name.","If on Linux, verify the casing matches exactly (e.g., Index.js vs index.js).","Use the 'Did you mean' hint in the diagnostic to pick the correct filename.","If the path is intentional but not yet created, create the file or switch to a glob pattern."],"exampleFix":"// before — package.json\n{\n  \"source\": \"src/inde.html\"\n}\n\n// after\n{\n  \"source\": \"src/index.html\"\n}","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction validatePackageSource(pkgPath) {\n  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));\n  const sources = Array.isArray(pkg.source) ? pkg.source : pkg.source ? [pkg.source] : [];\n  for (const s of sources) {\n    const full = path.join(path.dirname(pkgPath), s);\n    if (!fs.existsSync(full)) {\n      throw new Error(`Source file not found: ${full} (from package.json \"source\": \"${s}\")`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run a prebuild script that validates package.json source paths exist.","Use an IDE that warns on missing file references.","Add a lint rule or CI check that verifies entry files exist before building."],"tags":["entry","package-json","file-not-found","config"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}