{"record":{"id":"0bd1229a38bc373a","repo":"Budibase/budibase","slug":"please-run-in-a-plugin-directory-must-contain-sc","errorCode":null,"errorMessage":"Please run in a plugin directory - must contain schema.json","messagePattern":"Please run in a plugin directory - must contain schema\\.json","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/plugins/index.ts","lineNumber":57,"sourceCode":"    } catch (err: any) {\n      failed.push({\n        path: p,\n        error: err instanceof Error ? err.message : String(err),\n      })\n    }\n  }\n\n  return { deleted, failed }\n}\n\nfunction checkInPlugin() {\n  if (!fs.existsSync(\"package.json\")) {\n    throw new Error(\n      \"Please run in a plugin directory - must contain package.json\"\n    )\n  }\n  if (!fs.existsSync(\"schema.json\")) {\n    throw new Error(\n      \"Please run in a plugin directory - must contain schema.json\"\n    )\n  }\n}\n\nasync function askAboutTopLevel(name: string) {\n  const files = fs.readdirSync(process.cwd())\n  // we are in an empty git repo, don't ask\n  if (files.find(file => file === \".git\")) {\n    return false\n  } else {\n    console.log(\n      info(`By default the plugin will be created in the directory \"${name}\"`)\n    )\n    console.log(\n      info(\n        \"if you are already in an empty directory, such as a new Git repo, you can disable this functionality.\"\n      )","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/cli/src/plugins/index.ts#L39-L75","documentation":"checkInPlugin also requires schema.json alongside package.json; it is the plugin definition file the Budibase plugin system validates. If package.json exists but schema.json does not, this error is thrown before any verification or migration can run.","triggerScenarios":"Running `budibase-plugins verify` or `budibase-plugins migrateSvelte5` in a directory that has package.json but no schema.json (fs.existsSync(\"schema.json\") is false).","commonSituations":"An npm package directory that is not a Budibase plugin; schema.json deleted or renamed (e.g. schema.json.bak); running from a half-scaffolded plugin; schema.json gitignored and never generated.","solutions":["Restore or create schema.json in the plugin root (copy it from the budibase plugin template for your plugin type)","Re-scaffold the plugin with the init command to regenerate schema.json","Check that schema.json was not gitignored/excluded and is actually present: `ls schema.json`"],"exampleFix":"// before\nmy-plugin/ package.json  src/   (no schema.json)\nbudibase-plugins verify\n// Error: Please run in a plugin directory - must contain schema.json\n// after: add schema.json at plugin root\nmy-plugin/ package.json  schema.json  src/","handlingStrategy":"validation","validationCode":"import fs from \"fs\"\nif (!fs.existsSync(\"schema.json\")) {\n  throw new Error(\"Not a plugin directory: schema.json missing at plugin root.\")\n}","typeGuard":"const hasSchema = (dir: string = process.cwd()): boolean => fs.existsSync(`${dir}/schema.json`)","tryCatchPattern":null,"preventionTips":["Keep schema.json committed at the plugin root; never gitignore it","Copy schema.json from the official plugin template when creating a plugin","Verify with `ls schema.json` before running verify or migrateSvelte5"],"tags":["cli","filesystem","plugin","schema"],"backgroundTag":"missing-plugin-manifest","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}