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

  1. Search the named file for the construct described in the msg (e.g. all decorate calls) and fix the underlying issue.
  2. Regenerate the source with location info, or run the codemod on the original hand-written source.
  3. 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

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


AI-assisted analysis of mobxjs/mobx@01211a698b (2026-08-28). Data as JSON: /api/errors/bd6b52ff3fd0b8a2. Report an issue: GitHub.