Diagnostics
Inertia failures are typed so logs can say what kind of protocol step failed without dumping session data or prop values. Turn on protocol debug only when you need request classification.
Protocol debug
WithProtocolDebug(true) or INERTIA_PROTOCOL_DEBUG=true logs:
- request method, URL, whether the visit is Inertia, partial component,
only/except/reset, and purpose - page component, URL, prop keys, merge paths, deferred groups, and once-prop counts
It does not log prop values, flash payloads, or cookies. Generated scaffolds default this to true for local work; keep it off in production unless you are reproducing a protocol bug.
Error kinds
inertia.Error wraps the cause with:
| Field | Meaning |
|---|---|
Kind |
protocol, props, root, or ssr |
Operation |
Short step name such as resolve or encode page |
Component |
Page component when known |
Method, URL |
Request that failed |
PropPath |
Dotted prop path for evaluation failures |
Unwrap with errors.As. Handler logs should print Kind, Operation, Component, and PropPath before the cause.
Typical sources:
- protocol — invalid merge intent, version provider failure
- props — protected
errorskey, dotted-path conflict, resolver error, unsupported scroll metadata, JSON encode failure - root —
WithRootreturned nil, Templ render error - ssr — missing SSR client, empty body, missing
data-server-rendered/data-pagemarkers, or a wrapped transport error when fail-fast is on
SSR HTTP problems also surface as SSRTransportError (transport, status, encode, decode, response) and ErrResponseTooLarge.
What to inspect
When a visit misbehaves, compare the request you think you sent with the request the middleware parsed:
X-Inertia— missing means an initial document, not JSON.- Exact
componentstring versus the file underresources/js/Pages. X-Inertia-Partial-Componentversus the rendered component. Filters are ignored on mismatch.- Nested
only/exceptpaths after dotted unpacking. - Response
VarycontainingX-Inertia. X-Inertia-VersionversusbuildPathURLorWithVersion.- Redirect status:
303after unsafe methods,409for location / fragment / version reloads. - Whether
props.errorsis an object and whether a named bag was requested.
For SSR, separately verify:
- development posts to Vite
/__inertia_ssr, notINERTIA_SSR_URL - production
cmd/appposts toINERTIA_SSR_URL/render cmd/ssrbindsINERTIA_SSR_LISTENand the Node major meetsINERTIA_SSR_MINIMUM_MAJOR- bundle path or embedded
assets/dist/ssr/ssr.js /healthreturns{"status":"ok"}on the listen loopback- timeout and
INERTIA_SSR_MAX_RESPONSE_BYTES - fail-fast versus client fallback
Application usage
Do not log Props maps in controllers. If you need to see which keys were evaluated, enable protocol debug. If a resolver fails, return the error and let inertia.Error carry the prop path.
For tests, construct a renderer with a stub root and assert status, X-Inertia, and decoded page keys without starting Vite. SSR tests belong against HTTPRenderer or NewSSRRuntime with a fixture bundle, not against the full web process.