Nuxt · Runtime config

NUXT0102Do not read private runtimeConfig in client code

Finds client code that reads a private runtimeConfig key from useRuntimeConfig().

Why it happens

Nuxt sends only runtimeConfig.public and runtimeConfig.app to the browser, so any other top-level key is undefined there even though its type says string. In development Nuxt warns "Could not access key" (NUXT_E1003). Doctor checks components, pages, layouts, client plugins, and route middleware, using the private keys in the Doctor manifest. It skips server-only branches and plugins. It also skips server-registered components and conventional islands unless the import graph shows a raw file import that can bypass the registration. Component reports use heuristic-medium confidence because Doctor does not prove which parents render them. Without runtimeConfig evidence Doctor records an evidence gap instead.

Fix

Move the key under runtimeConfig.public if it is safe to expose. Otherwise read it in a server route and fetch the result, or guard the read with import.meta.server.

Example

Keep private config on the server

Before

<script setup lang="ts">
const config = useRuntimeConfig()
const { data } = await useFetch('https://api.example.com/items', {
  headers: { Authorization: config.apiSecret },
})
</script>

After

<script setup lang="ts">
const { data } = await useFetch('/api/items')
</script>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules nuxt/runtime/no-private-runtime-config-in-client
Copyright © 2026