{"record":{"id":"15bcd23f8cab9972","repo":"windmill-labs/windmill","slug":"database-path-not-provided","errorCode":null,"errorMessage":"Database path not provided","messagePattern":"Database path not provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/script/core.ts","lineNumber":478,"sourceCode":"// Generic DB schema tool factory shared by the script, flow and global modes\nexport function createDbSchemaTool<T>(\n\topts: { description?: string; updateEditorCache?: boolean } = {}\n): Tool<T> {\n\tconst { description, updateEditorCache = true } = opts\n\treturn {\n\t\tdef: description\n\t\t\t? {\n\t\t\t\t\t...DB_SCHEMA_FUNCTION_DEF,\n\t\t\t\t\tfunction: { ...DB_SCHEMA_FUNCTION_DEF.function, description }\n\t\t\t\t}\n\t\t\t: DB_SCHEMA_FUNCTION_DEF,\n\t\t// The one safe tool that starts a job: the job runs a fixed introspection query this\n\t\t// codebase authors, never the user's code, and writes nothing. Planning a change to a\n\t\t// database is not possible without its schema.\n\t\tplanModeSafe: true,\n\t\tfn: async ({ args, workspace, toolCallbacks, toolId }) => {\n\t\t\tif (!args.resourcePath) {\n\t\t\t\tthrow new Error('Database path not provided')\n\t\t\t}\n\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\tcontent: 'Getting database schema for ' + args.resourcePath + '...'\n\t\t\t})\n\t\t\tconst resource = await ResourceService.getResource({\n\t\t\t\tworkspace: workspace,\n\t\t\t\tpath: args.resourcePath\n\t\t\t})\n\t\t\tconst dbSchema = await getDbSchemas(\n\t\t\t\tresource.resource_type,\n\t\t\t\targs.resourcePath,\n\t\t\t\tworkspace,\n\t\t\t\t(error) => {\n\t\t\t\t\tconsole.error(error)\n\t\t\t\t}\n\t\t\t)\n\t\t\tif (!dbSchema) {\n\t\t\t\tthrow new Error('Database not found')","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/script/core.ts#L460-L496","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the tool with an explicit resourcePath, e.g. 'u/admin/marketing_db'","List available resources first (resource picker or ResourceService) and pick the right path","Rephrase the prompt to name the database resource explicitly"],"exampleFix":"// before\ncallTool('get_database_schema', {}) // throws\n// after\ncallTool('get_database_schema', { resourcePath: 'u/admin/marketing_db' })","handlingStrategy":"validation","validationCode":"if (!args.resourcePath || typeof args.resourcePath !== 'string') {\n  // prompt user/model for the database resource path before calling the tool\n}","typeGuard":"function hasResourcePath(args) {\n  return typeof args?.resourcePath === 'string' && args.resourcePath.trim().length > 0\n}","tryCatchPattern":null,"preventionTips":["Always name the database resource (e.g. u/admin/my_db) in prompts","List workspace resources first when the target is ambiguous","Treat resourcePath as mandatory in any schema-introspection request"],"tags":["database","ai-copilot","missing-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}