windmill-labs/windmill · error

Database path not provided

Error message

Database path not provided

What it means

The db-schema tool introspects a Windmill resource representing a database so the LLM can plan SQL changes. It requires a resourcePath argument; when the model omits it, the tool throws this error before making any API call.

Source

Thrown at frontend/src/lib/components/copilot/chat/script/core.ts:478

// Generic DB schema tool factory shared by the script, flow and global modes
export function createDbSchemaTool<T>(
	opts: { description?: string; updateEditorCache?: boolean } = {}
): Tool<T> {
	const { description, updateEditorCache = true } = opts
	return {
		def: description
			? {
					...DB_SCHEMA_FUNCTION_DEF,
					function: { ...DB_SCHEMA_FUNCTION_DEF.function, description }
				}
			: DB_SCHEMA_FUNCTION_DEF,
		// The one safe tool that starts a job: the job runs a fixed introspection query this
		// codebase authors, never the user's code, and writes nothing. Planning a change to a
		// database is not possible without its schema.
		planModeSafe: true,
		fn: async ({ args, workspace, toolCallbacks, toolId }) => {
			if (!args.resourcePath) {
				throw new Error('Database path not provided')
			}
			toolCallbacks.setToolStatus(toolId, {
				content: 'Getting database schema for ' + args.resourcePath + '...'
			})
			const resource = await ResourceService.getResource({
				workspace: workspace,
				path: args.resourcePath
			})
			const dbSchema = await getDbSchemas(
				resource.resource_type,
				args.resourcePath,
				workspace,
				(error) => {
					console.error(error)
				}
			)
			if (!dbSchema) {
				throw new Error('Database not found')

View on GitHub (pinned to e474e8803c)

Solutions

  1. Re-run the tool with an explicit resourcePath, e.g. 'u/admin/marketing_db'
  2. List available resources first (resource picker or ResourceService) and pick the right path
  3. Rephrase the prompt to name the database resource explicitly

Example fix

// before
callTool('get_database_schema', {}) // throws
// after
callTool('get_database_schema', { resourcePath: 'u/admin/marketing_db' })
Defensive patterns

Strategy: validation

Validate before calling

if (!args.resourcePath || typeof args.resourcePath !== 'string') {
  // prompt user/model for the database resource path before calling the tool
}

Type guard

function hasResourcePath(args) {
  return typeof args?.resourcePath === 'string' && args.resourcePath.trim().length > 0
}

Prevention

When it happens

Trigger: Calling the db schema tool with args lacking resourcePath (or an empty string), e.g. the model asks for a schema without naming which database resource.

Common situations: User asks 'what tables are in my database?' without specifying the resource; model forgets to fill resourcePath; workspace has resources but none was referenced in the prompt.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/15bcd23f8cab9972. Report an issue: GitHub.