---
title: "NUXT_B5031"
description: "A runtime config schema cannot be converted to JSON Schema."
canonical_url: "https://nuxt.com/docs/4.x/errors/b5031"
---
# B5031

Nuxt reads the type and default value of a [runtime config schema](https://nuxt.com/docs/4.x/guide/going-further/runtime-config#validating-with-a-schema) from its [Standard JSON Schema](https://standardschema.dev/json-schema) when the configuration is loaded. The schema itself is not included in your server bundle.

This error is reported when a schema does not implement Standard JSON Schema, or when the schema library cannot convert it (for example a schema that uses transforms). A schema for the whole of `runtimeConfig` must also describe a single object rather than a union.

## Resolution

Use a schema library that implements Standard JSON Schema, such as [Zod](https://zod.dev) or [ArkType](https://arktype.io). Wrap a [Valibot](https://valibot.dev) schema in `toStandardJsonSchema()`:

```ts [nuxt.config.ts]
import * as v from 'valibot'
import { toStandardJsonSchema } from '@valibot/to-json-schema'

export default defineNuxtConfig({
  runtimeConfig: {
    apiSecret: toStandardJsonSchema(v.string()),
  },
})
```

Remove transforms from runtime config schemas, and convert the value where you read it instead:

```ts [nuxt.config.ts]
import { z } from 'zod'

export default defineNuxtConfig({
  runtimeConfig: {
    allowedHosts: z.string().transform(value => value.split(',')), // [!code --]
    allowedHosts: z.array(z.string()).default([]), // [!code ++]
  },
})
```


## Sitemap

See the full [sitemap](https://nuxt.com/sitemap.md) for all pages.
