Skip to content

DTK0007: Invalid Dump Configuration

Package: @vitejs/devtools-rpc

Message

Function "{name}" with type "{type}" cannot have dump configuration. Only "static" and "query" types support dumps.

Cause

This error is thrown by validateDefinitions() (called at the start of dumpFunctions()) when an RPC function of type action or event has a dump property. Actions and events represent side effects or notifications and their results should not be pre-computed or cached, so dump configuration is only valid for static and query function types.

Example

ts
import { defineRpcFunction } from '@vitejs/devtools-kit'
import { dumpFunctions } from '@vitejs/devtools-rpc'

const sendNotification = defineRpcFunction({
  name: 'my-plugin:send-notification',
  type: 'action',
  handler: (msg: string) => { /* sends a notification */ },
  dump: {
    inputs: [['hello']], // not allowed for actions
  },
})

// Throws DTK0007 during validation
const store = await dumpFunctions([sendNotification])

Fix

Remove the dump property from action and event functions. If the function is actually a pure data retrieval, change its type to query or static:

ts
// Option 1: Remove dump from the action
const sendNotification = defineRpcFunction({
  name: 'my-plugin:send-notification',
  type: 'action',
  handler: (msg: string) => { /* sends a notification */ },
})

// Option 2: If it's actually a pure read, change the type
const getNotifications = defineRpcFunction({
  name: 'my-plugin:get-notifications',
  type: 'query', // pure data retrieval, dumps are allowed
  handler: () => ['notification-1', 'notification-2'],
  dump: {
    inputs: [[]],
  },
})

Source

packages/rpc/src/validation.ts

Released under the MIT License.