{"record":{"id":"69ca2f283743999a","repo":"parcel-bundler/parcel","slug":"could-not-find-entry-entry","errorCode":null,"errorMessage":"Could not find entry: ${entry}","messagePattern":"Could not find entry: (.+?)","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/requests/EntryRequest.js","lineNumber":318,"sourceCode":"                  ...getJSONSourceLocation(pkg.map.pointers[keyPath], 'value'),\n                },\n              });\n            }\n            i++;\n          }\n        }\n\n        // Only return if we found any valid entries\n        if (entries.length && files.length) {\n          return {\n            entries,\n            files,\n            globs,\n          };\n        }\n      }\n\n      throw new ThrowableDiagnostic({\n        diagnostic: {\n          message: md`Could not find entry: ${entry}`,\n        },\n      });\n    } else if (stat.isFile()) {\n      let projectRoot = this.options.projectRoot;\n      let packagePath = isDirectoryInside(\n        this.options.inputFS.cwd(),\n        projectRoot,\n      )\n        ? this.options.inputFS.cwd()\n        : projectRoot;\n\n      return {\n        entries: [\n          {\n            filePath: toProjectPath(this.options.projectRoot, entry),\n            packagePath: toProjectPath(this.options.projectRoot, packagePath),","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/requests/EntryRequest.js#L300-L336","documentation":"Thrown by resolveEntry() when the entry is a directory, a package.json was successfully read, but no valid entries were found — meaning package.json has no source field and no targets with source fields that resolve to existing files. The code falls through past the entries.length && files.length check.","triggerScenarios":"Entered when stat says the entry is a directory, readPackage() returns a parsed package.json, but the loop over pkg.source and pkg.targets[*].source produces zero entries (fields absent, empty, or all globs matching nothing). The final guard if (entries.length && files.length) is false.","commonSituations":"Pointing Parcel at a directory whose package.json lacks a source field and has no targets; package.json source field is an empty string or array; all target sources are globs that match zero files; package.json was auto-generated (e.g., by npm init) without a source.","solutions":["Add a \"source\" field to the directory's package.json pointing at your entry file.","Or add a \"targets\" section with at least one target that has a \"source\" field.","Verify the source value is non-empty and matches an existing file.","If using globs in source, confirm the glob pattern actually matches files in the directory."],"exampleFix":"// before — package.json (no source)\n{\n  \"name\": \"my-app\",\n  \"version\": \"1.0.0\"\n}\n\n// after\n{\n  \"name\": \"my-app\",\n  \"version\": \"1.0.0\",\n  \"source\": \"src/index.html\"\n}","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction validateDirectoryEntryHasSource(dir) {\n  const pkgFile = path.join(dir, 'package.json');\n  if (!fs.existsSync(pkgFile)) return; // different error path\n  const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf8'));\n  const hasSource = pkg.source != null;\n  const hasTargetSource = pkg.targets && Object.values(pkg.targets).some(t => t.source != null);\n  if (!hasSource && !hasTargetSource) {\n    throw new Error(`Directory ${dir} has package.json but no \"source\" field or targets with source.`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a source field in package.json for projects used as Parcel entries.","In monorepos, ensure each app package has its own source field.","Validate package.json structure in a prebuild CI step."],"tags":["entry","package-json","config","directory-entry"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}