microsoft / microsoft/vscode-powerquery-sdk
Invalid column reference in Table.AddColumn outputs null instead of an error
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 92
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Preflight Checklist
- I have installed the latest version of Power Query SDK.
- I have checked existing resources, including the common issues and the release notes.
- I have searched for similar issues.
Power Query SDK
0.2.1
Regression From
No response
Platform
Windows
Architecture
x64
OS Version
No response
VSCode version
No response
PQSdkTool Path
No response
Bug Description
In Power Query, when Table.AddColumn's column generator function references a non-existent column, the output generated for the new column should be an error.
Steps to Reproduce
- Create a new connector project with a
.test.pqfile defined as follows (the connector's contents don't matter):let Source = Table.View(null, [ GetRows = () => #table({"A"}, {{1}}), GetType = () => Value.Type(GetRows()) ]), Added = Table.AddColumn(Source, "B", each if [NonExistent] <> null then 1 else 2) in Added - Evaluate the test script file.
Actual Experience
The following two-column table is returned:
| A | B |
|---|---|
| 1 | null |
JSON version of the above:
"Output": [
{
"A": 1,
"B": null
}
]
Expected Experience
Column B should contain an error, not a null value.
Additional Context
If the same M code is evaluated in Power BI's Query Editor, the following output is produced (reflects the expected error):

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in a connector project's .test.pq file using the supplied Table.View and Table.AddColumn example; start by tracing how the SDK evaluates the test script and represents cell errors. Done when the missing [NonExistent] reference produces an error in column B rather than null, matching Power BI Query Editor behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100