mdlang
Documentation

Reference

Troubleshooting

Five errors cover almost everything. Each one tells you which stage failed — authoring, codegen, or the call itself.

generate skips my action with a warning about an MCP tool

Cause
The tool name on the MCP server doesn’t match what the action’s frontmatter declared.
Fix
Run generate with the server reachable. The warning names the server and the tool that failed to resolve — correct the name in mcpTools, or add the tool to the server.

Could not find an mdlang config file

Cause
The runtime expects mdlang.config.{ts,mts,js,mjs} in the directory you passed, or in process.cwd().
Fix
Point --cwd at the right directory, or move the config. Projects created before the rename can still use backend.config.* and BACKEND.md.

Invalid arguments for action "x"

Cause
Your payload didn’t match the action’s declared args.
Fix
The message lists each failing field. Check types and required flags in the action’s frontmatter — this fires before the model runs, so nothing was spent.

Action did not produce a structured response

Cause
The model returned text that didn’t match the declared output schema.
Fix
Tighten the action’s instruction so it states which fields to fill, or simplify the output shape. Deeply nested outputs are the usual culprit.

Cannot find module './actions/generated/…' after bundling

Cause
You’re on the runAction path, which resolves from disk at call time.
Fix
Import the generated action() wrapper instead. It uses static imports and survives bundling. See Programmatic API.

Turning up the detail

If an action is behaving oddly, the fastest way to see what the agent actually did is to raise the log level. debugadds tool inputs and outputs on top of the model’s decisions.

mdlang.config.ts
logging: {  level: "debug",  logAgentSteps: true,  logMcpCalls: true,  jsonlFile: "runs.jsonl",}

jsonlFileappends every completed run as an OpenAI-format transcript, which is the easiest thing to read back when a failure isn’t reproducible.

Still stuck

Open an issue at github.com/mdlang-dev/MDLang with the action file, the relevant part of your config, and the warning or error text.