vercel/swr · error · Error
Can’t trigger the mutation: missing key.
Error message
Can’t trigger the mutation: missing key.
What it means
Error "Can’t trigger the mutation: missing key." thrown in vercel/swr.
Source
Thrown at src/mutation/index.ts:56
error: Error | undefined
isMutating: boolean
}>({
data: UNDEFINED,
error: UNDEFINED,
isMutating: false
})
const currentState = stateRef.current
const trigger = useCallback(
async (arg: any, opts?: SWRMutationConfiguration<Data, Error>) => {
const [serializedKey, resolvedKey] = serialize(keyRef.current)
if (!fetcherRef.current) {
throw new Error('Can’t trigger the mutation: missing fetcher.')
}
if (!serializedKey) {
throw new Error('Can’t trigger the mutation: missing key.')
}
// Disable cache population by default.
const options = mergeObjects(
mergeObjects(
{ populateCache: false, throwOnError: true },
configRef.current
),
opts
)
// Trigger a mutation, and also track the timestamp. Any mutation that happened
// earlier this timestamp should be ignored.
const mutationStartedAt = getTimestamp()
ditchMutationsUntilRef.current = mutationStartedAt
setState({ isMutating: true })View on GitHub (pinned to 7173e55b2a)
When it happens
Trigger: Thrown at src/mutation/index.ts:56 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/swr@7173e55b2a (2026-08-27).
Data as JSON: /api/errors/10b0e9a9b24a6962.
Report an issue: GitHub.