DTK0012: RPC General Error
Package:
@vitejs/devtools
Message
RPC error on executing rpc
Cause
This error is logged when a general RPC error occurs outside of a specific function invocation. It is triggered by the onGeneralError hook in the createRpcServer configuration inside createWsServer().
Unlike DTK0011 which is scoped to a named function, this diagnostic covers errors in the RPC transport layer itself -- for example, message serialization failures, WebSocket protocol errors, or issues in the RPC resolver pipeline. The original error is attached as cause.
Example
General RPC errors typically arise from infrastructure-level issues rather than user code. For instance, if a function returns a value that cannot be serialized over the WebSocket connection:
import { defineRpcFunction } from '@vitejs/devtools-kit'
const myFunction = defineRpcFunction({
name: 'my-plugin:get-stream',
async handler() {
// Returning a non-serializable value may cause a general RPC error
return new ReadableStream()
},
})Fix
- Check the
causeattached to the diagnostic for the underlying error details. - Ensure all RPC function return values are JSON-serializable.
- If the error appears to be a WebSocket connectivity issue, verify that the DevTools server and client are properly connected.
- If the error persists and appears to be a bug in the RPC layer, report it to the Vite DevTools repository.
Source
packages/core/src/node/ws.ts