{"record":{"id":"a52bc7a8ea683ab0","repo":"OrchardCMS/OrchardCore","slug":"format-of-the-link-cannot-be-determined-based-on-the","errorCode":null,"errorMessage":"Format of the link cannot be determined based on the available argument of the a tag","messagePattern":"Format of the link cannot be determined based on the available argument of the a tag","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/AnchorTag.cs","lineNumber":122,"sourceCode":"                protocol != null ||\n                host != null ||\n                fragment != null ||\n                (routeValues != null && routeValues.Count > 0))\n            {\n                // User specified an href and one of the bound attributes; can't determine the href attribute.\n                throw new InvalidOperationException(\"Cannot override href with other properties\");\n            }\n\n            return Completion.Normal;\n        }\n\n        var routeLink = route != null;\n        var actionLink = controller != null || action != null;\n        var pageLink = page != null || pageHandler != null;\n\n        if ((routeLink && actionLink) || (routeLink && pageLink) || (actionLink && pageLink))\n        {\n            throw new InvalidOperationException(\"Format of the link cannot be determined based on the available argument of the a tag\");\n        }\n\n        RouteValueDictionary localRouteValues = null;\n        if (routeValues != null && routeValues.Count > 0)\n        {\n            localRouteValues = new RouteValueDictionary(routeValues);\n        }\n\n        if (area != null)\n        {\n            // Unconditionally replace any value from asp-route-area.\n            localRouteValues ??= [];\n            localRouteValues[\"area\"] = area;\n        }\n\n        TagBuilder tagBuilder;\n        if (pageLink)\n        {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/AnchorTag.cs#L104-L140","documentation":"The Liquid `a` tag can build its URL in exactly one of three ways: from `route`, from `controller`/`action`, or from `page`/`page-handler`. When arguments from two or more of these groups are present simultaneously, the tag cannot determine which link format to produce and throws. Exactly one link-generation style must be used per tag.","triggerScenarios":"`{% a route:'x', action:'Index' %}`, `{% a route:'x', page:'About' %}`, or `{% a action:'Index', page:'Privacy' %}` — any combination where routeLink && actionLink, routeLink && pageLink, or actionLink && pageLink is true.","commonSituations":"Migrating MVC anchor-tag-helper usage (where `asp-route` coexisted with `asp-action`) into the Liquid tag; combining a named route with an action thinking they merge; adding `page` for Razor Pages while leaving a leftover `action` argument.","solutions":["Keep only one link style: either `route`, or `action` (+ optional `controller`), or `page` (+ optional `page_handler`) — delete the others.","If you need route values with an action link, pass them via `route_values` (not `route`); `route_values` is a dictionary of parameters, `route` selects a named route.","Split into two separate anchors if you genuinely intended two different link targets."],"exampleFix":"// before\n{% a route:'custom-route', action:'Index', controller:'Home' %}Home{% enda %}\n// after\n{% a action:'Index', controller:'Home' %}Home{% enda %}\n// or\n{% a route:'custom-route' %}Home{% enda %}","handlingStrategy":"validation","validationCode":"// Ensure exactly one of route | action/controller | page/page-handler is set before rendering the tag\nvar styles = new[] { hasRoute, hasAction, hasPage }.Count(x => x);\nif (styles > 1) throw new InvalidOperationException(\"Pick exactly one link style for the a tag\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use route_values (dictionary) to add parameters to action links; reserve `route` strictly for named routes.","When converting MVC tag helpers to Liquid, drop `asp-route` when `action`/`page` is present.","Audit link templates for leftover arguments from copy-paste."],"tags":["liquid","razor-tags","invalid-argument","orchardcore"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}