{"record":{"id":"bbc388046f937d7e","repo":"windmill-labs/windmill","slug":"inferedschema-error","errorCode":null,"errorMessage":"${inferedSchema.error}","messagePattern":"\\$\\{inferedSchema\\.error\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/infer.ts","lineNumber":543,"sourceCode":"\t\t} else if (language == 'rlang') {\n\t\t\ttry {\n\t\t\t\tawait initWasmR()\n\t\t\t\tinferedSchema = JSON.parse(parse_r(code))\n\t\t\t} catch {\n\t\t\t\tinferedSchema = parseRSignatureFallback(code)\n\t\t\t}\n\t\t} else if (language == 'dbt') {\n\t\t\t// Absent on a parser package predating dbt: the editor keeps whatever\n\t\t\t// schema it has rather than clearing the run form to nothing.\n\t\t\tif (!parse_dbt) return null\n\t\t\tawait initWasmYaml()\n\t\t\tinferedSchema = JSON.parse(parse_dbt(code))\n\t\t\t// for related places search: ADD_NEW_LANG\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t\tif (inferedSchema.type == 'Invalid') {\n\t\t\tthrow new Error(inferedSchema.error)\n\t\t}\n\t\tloadSchemaLastRun.set([code, inferedSchema, mainOverride, language])\n\t}\n\n\tschema.required = []\n\tconst oldProperties = JSON.parse(JSON.stringify(schema.properties))\n\tschema.properties = {}\n\tfor (const arg of inferedSchema.args) {\n\t\tif (!(arg.name in oldProperties)) {\n\t\t\tschema.properties[arg.name] = { description: '', type: '' }\n\t\t} else {\n\t\t\tschema.properties[arg.name] = oldProperties[arg.name]\n\t\t\tif (schema.properties[arg.name].oneOf && !('oneof' in arg))\n\t\t\t\tdelete schema.properties[arg.name].oneOf\n\t\t}\n\t\tschema.properties[arg.name] = sortObject(schema.properties[arg.name])\n\n\t\targSigToJsonSchemaType(arg.typ, schema.properties[arg.name])","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/infer.ts#L525-L561","documentation":"inferArgs infers a script's argument schema from its code using language-specific parsers (e.g. WASM/Python/DBT parsers). When a parser returns a signature object with type 'Invalid', the parser's `error` field is thrown verbatim. It means the static analyzer could not parse the code's signature for that language — usually a syntax issue or an unsupported construct, or the WASM parser itself failed.","triggerScenarios":"Any caller (SCRIPT_SPEC, loadSchema*, inferSchemaIfNecessary, replaceScript) saving/loading a script whose code fails the language parser: e.g. dbt YAML that doesn't parse into a valid schema (parse_dbt returning type Invalid with an error), Python with unsupported signature constructs, or parser crashes surfaced as Invalid.","commonSituations":"Malformed dbt model config; Python code using constructs the signature parser doesn't support (e.g. *args/**kwargs in unexpected places, decorators confusing the parser); stale WASM parser module; code edited outside the editor introducing syntax errors.","solutions":["Read the embedded error in the message — it names the parser's specific complaint.","Fix the code syntax/construct the parser rejects (often visible as a syntax error).","For dbt scripts, validate the model's YAML/config is well-formed.","Define the args schema manually in the editor if the parser can't infer it.","Reload the page / update the parser WASM if the error looks like a parser bug rather than bad code."],"exampleFix":"// before: unparseable signature\ndef main(a, b=,)  # syntax error -> parser returns type Invalid\n// after\ndef main(a: int, b: str = 'x')","handlingStrategy":"try-catch","validationCode":"// check syntax with the runtime before inferring\nif (language === 'python') await pyodide.runPythonAsync(`compile(open('m.py').read(), 'm', 'exec')`) // throws on syntax errors","typeGuard":"function isInferenceValid(s: { type?: string; error?: string }): s is { type: string } & Record<string, unknown> {\n  return s.type !== 'Invalid' && !s.error\n}","tryCatchPattern":"try {\n  await inferArgs(language, code, parentAwareCode)\n} catch (e) {\n  // fall back to manual schema editing; keep last valid schema\n  showManualSchemaEditor(lastValidSchema)\n}","preventionTips":["Fix syntax errors before saving; the parser runs on every save/load.","Keep signatures simple (typed params, default values) so inference succeeds.","Maintain the args schema manually for code the static parser can't handle.","Keep the parser WASM up to date in the deployment."],"tags":["schema-inference","parser","static-analysis"],"backgroundTag":"schema-inference-failed","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"}