Budibase/budibase · error

Please run in a plugin directory - must contain schema.json

Error message

Please run in a plugin directory - must contain schema.json

What it means

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.

Source

Thrown at packages/cli/src/plugins/index.ts:57

    } catch (err: any) {
      failed.push({
        path: p,
        error: err instanceof Error ? err.message : String(err),
      })
    }
  }

  return { deleted, failed }
}

function checkInPlugin() {
  if (!fs.existsSync("package.json")) {
    throw new Error(
      "Please run in a plugin directory - must contain package.json"
    )
  }
  if (!fs.existsSync("schema.json")) {
    throw new Error(
      "Please run in a plugin directory - must contain schema.json"
    )
  }
}

async function askAboutTopLevel(name: string) {
  const files = fs.readdirSync(process.cwd())
  // we are in an empty git repo, don't ask
  if (files.find(file => file === ".git")) {
    return false
  } else {
    console.log(
      info(`By default the plugin will be created in the directory "${name}"`)
    )
    console.log(
      info(
        "if you are already in an empty directory, such as a new Git repo, you can disable this functionality."
      )

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Restore or create schema.json in the plugin root (copy it from the budibase plugin template for your plugin type)
  2. Re-scaffold the plugin with the init command to regenerate schema.json
  3. Check that schema.json was not gitignored/excluded and is actually present: `ls schema.json`

Example fix

// before
my-plugin/ package.json  src/   (no schema.json)
budibase-plugins verify
// Error: Please run in a plugin directory - must contain schema.json
// after: add schema.json at plugin root
my-plugin/ package.json  schema.json  src/
Defensive patterns

Strategy: validation

Validate before calling

import fs from "fs"
if (!fs.existsSync("schema.json")) {
  throw new Error("Not a plugin directory: schema.json missing at plugin root.")
}

Type guard

const hasSchema = (dir: string = process.cwd()): boolean => fs.existsSync(`${dir}/schema.json`)

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/0bd1229a38bc373a. Report an issue: GitHub.