microsoft / microsoft/work-iq

`workiq ask` crashes with JSON parse error on every query (streamed/multi-object response not handled)

Open
#200 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1k
Forks
132
Avg merge
5d 19h
Merged PRs (30d)
6

Description

Summary

Every workiq ask invocation fails with a System.Text.Json parse error, regardless of query content — including trivial ones like ask -q "hi". Auth, Microsoft Graph, and the underlying binary are all healthy; only the ask command's response parsing is broken. This has been failing for days.

Component: @microsoft/workiq CLI (ask command)
Severity: High — the ask command is 100% non-functional.

Environment

Item Value
workiq module @microsoft/workiq v1.0.0
workiq.exe (win-x64) 1.0.0.28144+10c4074955aee0affce923a5fb04d7ed22c5a09e
Host Microsoft Scout desktop app
Node (bundled) v24.18.0
OS Windows (Windows_NT)

Repro

> workiq ask -q "hi"
Error: '{' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 0 | BytePositionInLine: 887.

Fails identically for ask -q "say hello in one word.", ask --file-urls "<sharepoint-url>" -q "...", etc.

Root-cause hypothesis

The error is a .NET System.Text.Json JsonReaderException — the parser consumes one complete JSON object, then hits a second { and throws "Expected end of data." This is the classic signature of a streamed / NDJSON (newline-delimited, multi-object) response being handed to a single-object JsonSerializer.Deserialize call.

Confirming evidence: BytePositionInLine is independent of query length but tracks response size — e.g. "hi" → 887, longer file-url queries → 2772 / 3491. So the CLI reaches the backend and receives a response; it's the client-side deserialization of a multi-object stream that fails.

Likely a CLI ↔ backend protocol version mismatch: the service now returns streamed/chunked JSON objects, but this CLI build (28144) still deserializes the body as a single object.

Secondary bug

The process exits with code 0 despite the fatal error (observed EXITCODE=0), so callers/wrappers cannot detect the failure programmatically. It should exit non-zero on parse failure.

What works (scoping)

  • M365 sign-in status → OK (signed in)
  • In-process MCP tools (get_my_profile, get_recent_files) → OK
  • workiq.exe --version → OK
  • Only the CLI ask command → FAILS

Suggested fix

  • Parse the ask response as a stream of JSON objects (NDJSON) / handle chunked or SSE framing rather than Deserialize<T> on the whole body.
  • Return a non-zero exit code on parse failure.
  • Add a CLI/service protocol-version check with a clear error message on mismatch.

Contributor guide

Open the contributing guide

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 by reproducing workiq ask -q "hi" and tracing the ask command's System.Text.Json response parsing. Confirm how the streamed or multi-object response is framed, then verify that parse failures produce a non-zero exit code; done means ordinary ask queries succeed and failures are detectable by callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
backend-api-design, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.