{"record":{"id":"f1f0181e1b7df66c","repo":"laravel/framework","slug":"the-font-manifest-style-variables-must-be-an-obj","errorCode":null,"errorMessage":"The font manifest [style.variables] must be an object keyed by alias; the manifest was likely produced by an incompatible plugin version.","messagePattern":"The font manifest \\[style\\.variables\\] must be an object keyed by alias; the manifest was likely produced by an incompatible plugin version\\.","errorType":"exception","errorClass":"ViteException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Foundation/ViteFonts.php","lineNumber":107,"sourceCode":"     * @param  array{inline?: string, file?: string, familyStyles?: array<string, string>, variables?: array<string, string>}  $style\n     * @param  list<string>  $aliases\n     * @return string\n     *\n     * @throws \\Illuminate\\Foundation\\ViteException\n     */\n    protected function resolveFilteredStyleContent(array $style, array $aliases)\n    {\n        $familyStyles = $style['familyStyles'] ?? [];\n        $variables = $style['variables'] ?? [];\n\n        if (! is_array($familyStyles)) {\n            throw new ViteException(\n                'The font manifest [style.familyStyles] must be an object keyed by alias; the manifest was likely produced by an incompatible plugin version.'\n            );\n        }\n\n        if (! is_array($variables)) {\n            throw new ViteException(\n                'The font manifest [style.variables] must be an object keyed by alias; the manifest was likely produced by an incompatible plugin version.'\n            );\n        }\n\n        $parts = [];\n\n        foreach ($aliases as $alias) {\n            if (isset($familyStyles[$alias])) {\n                $parts[] = $familyStyles[$alias];\n            }\n        }\n\n        if ($variables !== []) {\n            $parts[] = $this->filterVariables($variables, $aliases);\n        }\n\n        return implode(\"\\n\\n\", $parts);\n    }","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Foundation/ViteFonts.php#L89-L125","documentation":"Companion check to error 286: the 'variables' field of a style entry must also be an array (alias-keyed object). If it is set but not an array, ViteException is thrown with the same plugin-version caveat. Both checks guard resolveFilteredStyleContent() before it iterates aliases.","triggerScenarios":"A font manifest style entry has 'variables' set to a non-array value (string, number, null-filled object). Same root cause as 286 — producer/consumer version skew on the manifest schema.","commonSituations":"Plugin upgrade/downgrade mismatch. Manually crafted manifests. Switching between CSS-variable-based font plugins and older ones.","solutions":["Match the font plugin version to the Laravel Vite integration version.","Regenerate the manifest so variables is {\"alias\": \"--var: value;\"} shaped.","Audit with jq '.styles[] | .variables | type' across the manifest.","Filter the aliases list to only those the producer actually emits in the correct shape."],"exampleFix":"// before\n{ \"style\": { \"variables\": \"--font-heading: Inter;\" } }\n\n// after\n{ \"style\": { \"variables\": { \"default\": \"--font-heading: Inter;\" } } }","handlingStrategy":"validation","validationCode":"$manifest = json_decode(file_get_contents($path), true);\nforeach ($manifest['styles'] ?? [] as $style) {\n    if (isset($style['variables']) && ! is_array($style['variables'])) {\n        throw new RuntimeException('variables must be an object; plugin version mismatch.');\n    }\n}","typeGuard":"function variablesWellShaped(array $style): bool {\n    return ! isset($style['variables']) || is_array($style['variables']);\n}","tryCatchPattern":"use Illuminate\\Foundation\\ViteException;\n\ntry {\n    $css = $viteFonts->resolveFilteredStyleContent($style, $aliases);\n} catch (ViteException $e) {\n    if (str_contains($e->getMessage(), 'variables')) { /* rebuild manifest */ }\n}","preventionTips":["Lock font plugin version to the Laravel integration version.","Lint manifest in CI: assert variables is an object.","Regenerate manifests after any upgrade.","Document the alias-keyed object contract for any custom font plugin."],"tags":["vite","laravel","fonts","manifest","schema"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}