PrismLibrary/Prism · error · InvalidOperationException
The generated URI has one or more relative back operators…
Error message
The generated URI has one or more relative back operators and was marked as an absolute path. This is not supported.
What it means
NavigationBuilder.BuildUri assembles the final navigation URI from accumulated segments. If '..' (RelativeBack) segments appear but _absoluteNavigation is true (builder created with absolute navigation), the resulting URI mixes an absolute root with relative back operators, which Shell/app navigation cannot resolve — so Prism throws InvalidOperationException.
Solutions
- Remove the RelativeBack()/'..' segments when using absolute navigation; use relative navigation if you need back operators.
- Replace back-operator navigation with an explicit absolute path to the target page: AddSegment("HomePage").AddSegment("DetailPage").
- If dynamic, check segments for '..' before setting _absoluteNavigation and downgrade to relative navigation.
Example fix
// before
var builder = navigationService.CreateBuilder(useAbsoluteNavigation: true);
builder.AddSegment("..")... // not supported
// after
var builder = navigationService.CreateBuilder(); // relative
builder.RelativeBack().NavigateAsync();
// or absolute without back:
navigationService.CreateBuilder(useAbsoluteNavigation: true).AddSegment("HomePage").NavigateAsync(); Defensive patterns
Strategy: validation
Validate before calling
if (isAbsoluteNavigation && segments.Any(s => s == ".."))
throw new InvalidOperationException("Back operators are not allowed with absolute navigation."); Try / catch
try
{
await navigationService.NavigateAsync(uri);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("relative back operators"))
{
logger.LogError(ex, "Invalid navigation URI mixing absolute path and back operators");
} Prevention
- Never combine useAbsoluteNavigation:true with RelativeBack().
- Encapsulate navigation building in a helper that enforces absolute-vs-relative rules.
- For 'go up' semantics with absolute navigation, spell out the full target path instead.
When it happens
Trigger: Using navigationService.CreateBuilder(absolute: true) (or UriPathIsAbsolute behavior) combined with .RelativeBack() segments: e.g. CreateBuilder absolute navigation then AddSegment("..").
Common situations: Attempting to go back while also prefixing '/' for absolute paths; copying a relative-back navigation recipe into an absolute-navigation context; refactoring a relative navigation chain to absolute without removing back segments.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- The constructed URI contains one or more relative back…
- The constructed URI has a relative back operator after a…
- Cannot process an absolute Navigation Uri when navigating…
- source
- uri
AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15).
Data as JSON: /api/errors/bb8bdd315e927de0.
Report an issue: GitHub.
Appendix: source
Thrown at src/Maui/Prism.Maui/Navigation/Builder/NavigationBuilder.cs:109
}
public INavigationBuilder WithParameters(INavigationParameters parameters)
{
foreach ((var key, var value) in parameters)
_navigationParameters.Add(key, value);
return this;
}
internal Uri BuildUri()
{
var uri = (_absoluteNavigation ? "/" : string.Empty) +
string.Join("/", _uriSegments.Select(x => x.Segment));
if(uri.Contains("../"))
{
if (_absoluteNavigation)
throw new InvalidOperationException("The generated URI has one or more relative back operators and was marked as an absolute path. This is not supported.");
var segments = uri.Split('/');
if (!segments.Any(x => x != ".."))
throw new InvalidOperationException($"The constructed URI contains one or more relative back operators, but contains no other navigation segments - '{uri}'.");
var hasNonBackSegment = false;
for(int i = 0; i < segments.Length; i++)
{
if (hasNonBackSegment && segments[i] == "..")
throw new InvalidOperationException($"The constructed URI has a relative back operator after a new Navigation Segment which is not supported - '{uri}'.");
else if (segments[i] != "..")
hasNonBackSegment = true;
}
}
return UriParsingHelper.Parse(uri);
}
}
View on GitHub (pinned to 358118cd64)