{"record":{"id":"5daf01bea8514b29","repo":"mastra-ai/mastra","slug":"plugin-entry-file-does-not-exist-explicitentry","errorCode":null,"errorMessage":"Plugin entry file does not exist: ${explicitEntry}","messagePattern":"Plugin entry file does not exist: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mastracode/sdk/src/plugins/install.ts","lineNumber":166,"sourceCode":"  }\n}\n\nexport function detectEntry(pluginDir: string, explicitEntry?: string): string {\n  const root = path.resolve(pluginDir);\n  if (explicitEntry) {\n    const entryPath = path.resolve(pluginDir, explicitEntry);\n    if (!isInsideDirectory(entryPath, root)) {\n      throw new Error('Plugin entry must be inside the plugin directory');\n    }\n    if (fs.existsSync(entryPath) && fs.statSync(entryPath).isDirectory()) {\n      const nestedEntry = detectEntry(entryPath);\n      return path.relative(root, path.join(entryPath, nestedEntry));\n    }\n    if (path.extname(entryPath) !== '.ts') {\n      throw new Error('Plugin entry must be a .ts file');\n    }\n    if (!fs.existsSync(entryPath) || !fs.statSync(entryPath).isFile()) {\n      throw new Error(`Plugin entry file does not exist: ${explicitEntry}`);\n    }\n    return path.relative(root, entryPath);\n  }\n\n  const manifestPlugin = getSingleManifestPlugin(pluginDir);\n  if (manifestPlugin) {\n    return detectEntry(pluginDir, manifestPlugin.entry);\n  }\n\n  for (const candidate of ENTRY_CANDIDATES) {\n    const entryPath = path.join(pluginDir, candidate);\n    if (fs.existsSync(entryPath) && fs.statSync(entryPath).isFile()) {\n      return candidate;\n    }\n  }\n\n  throw new Error(`Could not find a plugin entry file. Tried: ${ENTRY_CANDIDATES.join(', ')}`);\n}","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/sdk/src/plugins/install.ts#L148-L184","documentation":"After confirming the explicit entry is an in-bounds `.ts` path, detectEntry checks that the file actually exists on disk and is a regular file. Missing files or paths that resolve to something else (symlink to nowhere, directory named `x.ts`) produce this error naming the explicit entry.","triggerScenarios":"Calling entry/detectEntry with explicitEntry that passes the .ts check but where fs.existsSync is false or fs.statSync(...).isFile() is false — e.g. `entry: 'src/indx.ts'` (typo) or the file was deleted/renamed.","commonSituations":"Typo in the entry filename; file renamed during refactor; case-mismatch on case-sensitive filesystems (Index.ts vs index.ts); stale config after moving source files.","solutions":["Correct the entry path to the actual file name; run `ls src/` to confirm.","Check filename casing matches exactly (case-sensitive on Linux).","Update or remove the explicit `entry` setting after refactors and rely on auto-detection.","Ensure the plugin was fully cloned/checked out (file not gitignored)."],"exampleFix":"// before\n{ entry: 'src/indx.ts' }\n\n// after\n{ entry: 'src/index.ts' }","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nexport function assertEntryFileExists(pluginDir: string, entry: string): void {\n  const p = path.resolve(pluginDir, entry);\n  if (!fs.existsSync(p) || !fs.statSync(p).isFile()) {\n    throw new Error(`Plugin entry file does not exist: ${entry}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installPlugin(dir, { entry });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Plugin entry file does not exist')) {\n    console.error(`Verify path/case in ${dir}; available:`, fs.readdirSync(path.join(dir, 'src')));\n  }\n  throw err;\n}","preventionTips":["Match filename casing exactly (Linux is case-sensitive).","Re-check `entry` config after any file renames or refactors.","Ensure entry files aren't excluded by .gitignore in the plugin repo."],"tags":["filesystem","plugins","configuration"],"backgroundTag":"entry-file-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}