microsoft / microsoft/Power-Fx

Confusing error message for untyped type mismatch

Open
#1,298 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

> Time(3,0,0) = ParseJSON("[2]")
Error: InvalidArgument - The untyped object argument to the 'TimeValue' function has an incorrect type. 
Expected: Text, Actual: Microsoft.PowerFx.Types.ExternalType.

> Time(3,0,0) = ParseJSON("{""a"":3}")
Error: InvalidArgument - The untyped object argument to the 'TimeValue' function has an incorrect type. 
Expected: Text, Actual: Microsoft.PowerFx.Types.ExternalType.

> Time(3,0,0) = ParseJSON("true")
Error: InvalidArgument - The untyped object argument to the 'TimeValue' function has an incorrect type. 
Expected: Text, Actual: Boolean.

Note that the first two error messages refer to an internal data type and don't clarify that they found an array or an object. This is different from the last example which maps to a FormulaValue and for which a more useful "Boolean" can be provided.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the TimeValue and ParseJSON error paths shown in the examples, then compare how Boolean types are rendered with the internal ExternalType cases. Done means array and object inputs report useful type names rather than the internal data type; verify the three examples produce clearer messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.