Devolutions/UniGetUI · error · InvalidOperationException
Bundle export only supports .ubundle and .json output files.
Error message
Bundle export only supports .ubundle and .json output files.
What it means
Thrown by IpcBundleApi.ResolveExportFormat when exporting a bundle to a file whose extension is neither '.json', '.ubundle', nor empty. Note the asymmetry: import (ParseFormat) accepts yaml/yml/xml too, but export is intentionally limited to ubundle and json because those are the only serialization paths the export writer implements.
Source
Thrown at src/UniGetUI.Interface.IpcApi/IpcBundleApi.cs:523
return BundleFormatType.UBUNDLE;
}
return ParseFormat(Path.GetExtension(request.Path));
}
private static BundleFormatType ResolveExportFormat(string? path)
{
if (string.IsNullOrWhiteSpace(path))
{
return BundleFormatType.UBUNDLE;
}
var extension = Path.GetExtension(path);
return extension.ToLowerInvariant() switch
{
".json" => BundleFormatType.JSON,
".ubundle" or "" => BundleFormatType.UBUNDLE,
_ => throw new InvalidOperationException(
"Bundle export only supports .ubundle and .json output files."
),
};
}
private static BundleFormatType ParseFormat(string? format)
{
return format?.Trim().TrimStart('.').ToLowerInvariant() switch
{
null or "" or "ubundle" => BundleFormatType.UBUNDLE,
"json" => BundleFormatType.JSON,
"yaml" or "yml" => BundleFormatType.YAML,
"xml" => BundleFormatType.XML,
_ => throw new InvalidOperationException(
$"The bundle format \"{format}\" is not supported."
),
};
}View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Change the export --path to end in .ubundle (or omit the extension, which defaults to ubundle).
- If you need JSON output, name the file with a .json extension.
- If you require yaml/xml output, first export to .json/.ubundle then convert with an external tool; the IPC API export path does not support it.
Example fix
// before unigetui bundle export --path ~/backups/pkg-set.yaml // after unigetui bundle export --path ~/backups/pkg-set.ubundle
Defensive patterns
Strategy: validation
Validate before calling
static bool IsValidExportPath(string? path) =>
string.IsNullOrWhiteSpace(path)
|| Path.GetExtension(path).ToLowerInvariant() is ".json" or ".ubundle" or "";
// call before export:
if (!IsValidExportPath(request.Path))
throw new ArgumentException("Export path must end in .ubundle or .json"); Prevention
- Centralize export-path validation in the caller before hitting the IPC boundary.
- Remember export supports fewer formats than import; do not reuse import format lists for export.
- Default the export path to a .ubundle extension when none is given.
When it happens
Trigger: Calling the bundle export IPC endpoint (or CLI 'bundle export') with a --path argument whose extension is something other than .json/.ubundle (e.g. '--path backup.yaml', '--path backup.xml', '--path backup.txt'). ResolveExportFormat reads Path.GetExtension and falls to the default switch arm.
Common situations: A user who successfully imported a .yaml bundle assumes they can re-export to the same format. Scripting a backup pipeline that normalizes all outputs to one extension (e.g. .bak) without realizing export rejects it. Copying an import flag set (--format yaml) into an export command.
Related errors
- The bundle format "{format}" is not supported.
- The bundle selection mode "{selection}" is not supported.
- The value supplied to {argumentName} must be either true or
- Exactly one of content or path must be supplied when importi
- The bundle content could not be parsed.
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/54691fb0cf9948c8.
Report an issue: GitHub.