BCUninstaller/Bulk-Crap-Uninstaller · error · InvalidDataException

Scoop export is in unkown or invalid format! Try updating Sc

Error message

Scoop export is in unkown or invalid format! Try updating Scoop and try again.\n\nContents:\n{result}

What it means

An InvalidDataException thrown in ScoopFactory's fallback parser when the plain-text export line equals `"apps":` or `"buckets":`. The factory first tries JSON deserialization (the modern Scoop export format since July 2022); on JsonException it falls back to line-based parsing. Encountering raw JSON keys in that fallback path means the export is a corrupted/truncated JSON blob that also fails plain-text parsing, so it is rejected with an upgrade-Scoop hint and the full contents attached.

Source

Thrown at source/UninstallTools/Factory/ScoopFactory.cs:254

                        var startIndex = str.IndexOf("(v:", StringComparison.Ordinal);
                        if (startIndex > 0)
                        {
                            var verEndIndex = str.IndexOf(')', startIndex);
                            version = str.Substring(Math.Min(startIndex + 3, str.Length - 1), Math.Max(verEndIndex - startIndex - 3, 0));
                            if (version.Length == 0) version = null;
                        }
                        isGlobal = str.Substring(spaceIndex).Contains("*global*");
                    }
                    else
                    {
                        name = str;
                    }

                    // Make sure that this isn't just a corrupted json export
                    if (string.Equals(name, "\"apps\":", StringComparison.Ordinal) ||
                        string.Equals(name, "\"buckets\":", StringComparison.Ordinal))
                        throw new InvalidDataException("Scoop export is in unkown or invalid format! Try updating Scoop and try again.\n\nContents:\n" + result, e);

                    var entry = CreateUninstallerEntry(name, version, isGlobal, exeSearcher);

                    results.Add(entry);
                }
            }

            return results;
        }

        private sealed class AppInstall
        {
            public string Bucket { get; set; }
            public string Architecture { get; set; }
        }
        private sealed class AppManifest
        {
            public string Homepage { get; set; }

View on GitHub (pinned to 608321de98)

Solutions

  1. Run `scoop update` to update Scoop itself, then retry the export.
  2. If it persists, run `scoop reset` or reinstall Scoop to repair its scripts.
  3. Manually run `scoop export` and inspect the output for truncation or encoding issues.
  4. Check the Scoop GitHub issues for the installed version's known export bugs.
Defensive patterns

Strategy: retry

Validate before calling

// Sanity-check scoop export output before parsing.
var result = RunScoopCommand("export");
if (string.IsNullOrWhiteSpace(result)) return results;
bool looksLikeJson = result.TrimStart().StartsWith("{");
if (looksLikeJson && (!result.Contains("\"apps\"") || !result.EndsWith("}")))
    throw new InvalidDataException("Scoop export appears truncated; update Scoop and retry.");

Try / catch

try { /* parse scoop export */ }
catch (InvalidDataException ex) when (ex.Message.Contains("Scoop export is in unkown"))
{ /* run `scoop update`, then retry export once */ }

Prevention

When it happens

Trigger: Scoop's `export` command produced output that is neither valid JSON nor valid plain text: truncated JSON (starts with `{` but cut off), a Scoop version that emits a half-broken format, or a pipe encoding issue that mangled the output.

Common situations: Outdated Scoop version with a known export bug; Scoop updated mid-way leaving mixed-format state; terminal/redirect encoding corrupted the export; Scoop bucket corruption.

Related errors


AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13). Data as JSON: /api/errors/7b163a6643628832. Report an issue: GitHub.