tauri-apps/tauri · warning
IPC custom protocol failed, Tauri will now use the…
Error message
IPC custom protocol failed, Tauri will now use the postMessage interface instead
What it means
sendIpcMessage first attempts to deliver IPC messages through the webview's custom protocol (fetch-style). When that request rejects (webview blocks the custom scheme, CSP blocks the fetch, or the request errors), it logs this warning and permanently flips customProtocolIpcFailed so all subsequent IPC falls back to the postMessage interface.
Solutions
- Inspect the accompanying error `e` in the console to identify the blocking cause (CSP violation vs blocked scheme).
- Update your CSP to allow the IPC origin, e.g. connect-src 'self' ipc: http://ipc.localhost tauri: in tauri.conf.json.
- Ensure the webview/window is created through Tauri's builders so the custom protocol handler is registered.
- If the fallback is acceptable, no action is needed — postMessage IPC still works, just with different performance characteristics.
Example fix
// before: CSP blocking IPC "csp": "default-src 'self'" // after "csp": "default-src 'self'; connect-src 'self' ipc: http://ipc.localhost tauri:"
Defensive patterns
Strategy: fallback
Validate before calling
const csp = window.__TAURI_INTERNALS__?.metadata?.currentCsp
if (csp && !/connect-src[^;]*(ipc|tauri)/.test(csp)) console.warn('CSP may block custom protocol IPC') Try / catch
window.__TAURI_INTERNALS__.invoke('cmd')
.catch((e) => {
if (String(e).includes('custom protocol')) {
// library already falls back to postMessage; surface a config hint
console.warn('Enable ipc: http://ipc.localhost in CSP connect-src')
}
}) Prevention
- Include ipc: and http://ipc.localhost in your CSP connect-src from day one.
- Create webviews only through Tauri's window builders so the protocol handler is registered.
- Check the console for this warning in CI/e2e runs to catch CSP regressions early.
When it happens
Trigger: The custom-protocol IPC fetch fails: webview configuration disallows the tauri:// (or similar) scheme, a Content-Security-Policy connect-src directive blocks the request, or the protocol request itself errors.
Common situations: Strict CSP configured without allowing the Tauri IPC scheme in connect-src, custom webview builders that don't register the IPC custom protocol handler, or embedded webviews where the scheme is blocked by platform policy.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- [TAURI] Couldn't find callback id
- failed to get random bytes
- failed to serialize scope
- invalid capability
- Invalid channel definition from \(channelDef)
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/80f870aed2a462e2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri/scripts/ipc-protocol.js:60
.then((response) => {
const callbackId =
response.headers.get('Tauri-Response') === 'ok' ? callback : error
// we need to split here because on Android the content-type gets duplicated
switch ((response.headers.get('content-type') || '').split(',')[0]) {
case 'application/json':
return response.json().then((r) => [callbackId, r])
case 'text/plain':
return response.text().then((r) => [callbackId, r])
default:
return response.arrayBuffer().then((r) => [callbackId, r])
}
})
.then(
([callbackId, data]) => {
window.__TAURI_INTERNALS__.runCallback(callbackId, data)
},
(e) => {
console.warn(
'IPC custom protocol failed, Tauri will now use the postMessage interface instead',
e
)
// failed to use the custom protocol IPC (either the webview blocked a custom protocol or it was a CSP error)
// so we need to fallback to the postMessage interface
customProtocolIpcFailed = true
sendIpcMessage(message)
}
)
} else {
// otherwise use the postMessage interface
const { data } = processIpcMessage({
cmd,
callback,
error,
options: {
...options,
customProtocolIpcBlocked: customProtocolIpcFailedView on GitHub (pinned to 460ec35447)