jdx/mise · error

mas list --json returned no parseable app objects

Error message

mas list --json returned no parseable app objects

What it means

`parse_mas_json` parses the output of `mas list --json`. If the whole output parses as a JSON array but none of its elements yield an app (ID and version), and the array was non-empty, the backend raises this error rather than returning an empty install list. It guards against silently treating malformed mas output as "nothing installed".

Solutions

  1. Check `mas version` and upgrade/downgrade mas so its `list --json` output matches the expected schema (objects with ID and version fields).
  2. Run `mas list --json` manually and inspect the raw JSON to see which fields the objects actually contain.
  3. Fall back to text output by checking whether a non-JSON mas is installed or the CLI supports --json at all.
Defensive patterns

Strategy: try-catch

Validate before calling

let out = Command::new("mas").args(["list", "--json"]).output()?;
let v: serde_json::Value = serde_json::from_slice(&out.stdout)?;
if let Value::Array(arr) = &v {
    let ok = arr.iter().all(|o| o.get("id").is_some() && o.get("version").is_some());
    if !ok { /* upgrade mas or fall back to text parsing */ }
}

Type guard

fn looks_like_mas_app(v: &serde_json::Value) -> bool { v.get("id").is_some() && v.get("version").is_some() }

Try / catch

match backend.installed(&pkgs, &opts).await {
    Ok(apps) => apps,
    Err(e) if e.to_string().contains("no parseable app objects") => { /* upgrade mas, then retry */ Vec::new() }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling mas_list (e.g. via the installed() query) where `mas list --json` prints a valid JSON array whose objects are missing the fields parse_mas_json_value requires (numeric/parseable id and version), so every element maps to None.

Common situations: A newer or older mas version changed the JSON schema of `mas list --json` (field renames like `adam_id` vs `id`); mas emitting error/placeholder JSON objects on an oddly configured system.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/bac2be129a3b3fc7. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/mas.rs:101

            "versionString",
        ],
    )?;
    Some(InstalledApp {
        adam_id,
        bundle_id,
        version,
    })
}

fn parse_mas_json(output: &str) -> EyreResult<Vec<InstalledApp>> {
    let output = output.trim();
    if output.is_empty() {
        return Ok(vec![]);
    }
    if let Ok(Value::Array(values)) = serde_json::from_str::<Value>(output) {
        let apps: Vec<_> = values.iter().filter_map(parse_mas_json_value).collect();
        if apps.is_empty() && !values.is_empty() {
            bail!("mas list --json returned no parseable app objects");
        }
        return Ok(apps);
    }
    let mut apps = vec![];
    for line in output
        .lines()
        .map(str::trim)
        .filter(|line| !line.is_empty())
    {
        let value = serde_json::from_str::<Value>(line)
            .map_err(|err| eyre!("mas list --json returned invalid JSON: {err}"))?;
        match parse_mas_json_value(&value) {
            Some(app) => apps.push(app),
            None => bail!("mas list --json returned an app object without an ID and version"),
        }
    }
    Ok(apps)
}

View on GitHub (pinned to 533346cc37)