Skip to content

statusline-command.sh silently shows empty defaults when jq is missing (common on fresh Linux/WSL installs) #1065

@MHoroszowski

Description

@MHoroszowski

Summary

On a fresh Ubuntu 24.04 / WSL2 install, jq is not present by default. statusline-command.sh depends on jq for every piece of data it displays — parsing stdin from Claude Code, reading settings.json, extracting model/context/cost/version info, counts, weather, location, etc.

Because every jq invocation in the script is defensively wrapped in 2>/dev/null with fallback defaults, a missing jq produces silent, confusing degradation instead of a loud error. The status line renders successfully but every field shows its empty default:

LOC: Unknown,
ENV: CC: 2.1.104 | PAI:— ALG:—
CONTEXT: 0%
PWD: (empty)
MEMORY: 0 Work | 0 Ratings | 0 Sessions | 0 Research
LEARNING: No ratings yet

Users understandably assume the status line is broken. In my case I spent time investigating Claude Code's refresh cadence, tty detection, and WSL rendering before checking which jq and finding it wasn't installed. Once I ran sudo apt-get install -y jq, every field populated correctly on the next refresh.

Platform

  • Ubuntu 24.04 on WSL2 (Windows 11)
  • Claude Code 2.1.104
  • PAI v4.0.3

Reproduction

  1. Fresh Ubuntu / WSL2 install (or any Linux env without jq preinstalled)
  2. Install PAI normally
  3. Open Claude Code
  4. Observe the status line shows empty defaults for every field
  5. which jq returns nothing

Suggested fixes (in order of increasing scope)

  1. Minimal: Add a loud check at the top of statusline-command.sh that prints a clear single-line error if jq isn't on PATH, e.g.:

    if ! command -v jq >/dev/null 2>&1; then
      echo "PAI statusline: jq not found. Install with: sudo apt-get install -y jq (or brew install jq)"
      exit 0
    fi

    This turns a silent failure into an actionable one-line message.

  2. Better: Have install.sh check for and install hard dependencies on Linux, mirroring what most users have on macOS via Homebrew. In practice the full list for a functional PAI install on Ubuntu/WSL is approximately:

  3. Most complete: Add a bin/check-dependencies.sh that runs at SessionStart via hook, validates all hard dependencies, and warns the user once with a copy-pasteable install command for their distro.

I'm happy to submit a PR for option (1) immediately — it's a ~5-line change and turns an opaque failure into an actionable one. Options (2) and (3) are bigger conversations.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions