mobxjs/mobx · warning
[mobx:undecorate] ${msg} at (${fileInfo.path})
Error message
[mobx:undecorate] ${msg} at (${fileInfo.path})
What it means
Fallback format of the codemod's `warn` helper used when the AST node has no location info (`node.loc` is null): it prints the message with only the file path, no line/column or source excerpt.
Source
Thrown at packages/mobx-undecorate/src/undecorate.ts:540
}
function warn(msg: string, node: Node) {
if (process.env.NODE_ENV === "test") {
return
}
if (node.loc) {
const line = lines[node.loc.start.line - 1]
const shortline = line.replace(/^\s*/, "")
console.warn(
`[mobx:undecorate] ${msg} at (${fileInfo.path}:${node.loc.start.line}:${
node.loc.start.column
}):\n\t${shortline}\n\t${"^".padStart(
node.loc.start.column + 1 - line.indexOf(shortline),
" "
)}\n`
)
} else {
console.warn(`[mobx:undecorate] ${msg} at (${fileInfo.path})\n`)
}
}
}
View on GitHub (pinned to 01211a698b)
Solutions
- Search the named file for the construct described in the msg (e.g. all decorate calls) and fix the underlying issue.
- Regenerate the source with location info, or run the codemod on the original hand-written source.
- Fix the issue then re-run to confirm the warning disappears.
Example fix
// before
decorate(Store) // generated node without loc
// after
decorate(Store, { count: observable }) Defensive patterns
Strategy: fallback
Try / catch
try {
await runCodemod(files)
} catch (e) {
console.error('Codemod failed on generated code without location info; run it on original sources instead')
} Prevention
- Run the codemod on original hand-written sources, not generated output
- Keep source maps/locations intact by running codemods before other transforms
- Grep files for remaining `decorate(` calls when warnings lack line numbers
When it happens
Trigger: A warn() is triggered for a node lacking `loc` — typically programmatically generated nodes, or output of prior transforms that dropped position data.
Common situations: Running the codemod on machine-generated code, ASTs already partially transformed, or code produced by other codemods that stripped source locations.
Related errors
- [mobx:undecorate] ${msg} at (${fileInfo.path}:${node.loc.sta
- Expected a decorate call with two arguments
- Expected exactly one class declaration for '${target.name}'
- Failed to find mobx import, can't add makeObservable as depe
- Found multiple decorators, skipping..
AI-assisted analysis of mobxjs/mobx@01211a698b (2026-08-28).
Data as JSON: /api/errors/bd6b52ff3fd0b8a2.
Report an issue: GitHub.