{"record":{"id":"fa1f009e47bf3393","repo":"octobercms/october","slug":"import-script-is-missing-definition-for-attribute","errorCode":null,"errorMessage":"Import script is missing definition for 'attributes'","messagePattern":"Import script is missing definition for 'attributes'","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/cms/models/ThemeSeed.php","lineNumber":220,"sourceCode":"    /**\n     * processSeedInstruction\n     */\n    protected function processSeedInstruction($instruction)\n    {\n        $importName = $instruction['name'] ?? 'Import Data';\n        $className = $instruction['class'] ?? null;\n        $fileName = $instruction['file'] ?? null;\n        $attributes = $instruction['attributes'] ?? null;\n        $matches = $instruction['matches'] ?? null;\n\n        if (!$className) {\n            throw new SystemException(\"Import script is missing definition for 'class'\");\n        }\n        if (!$fileName) {\n            throw new SystemException(\"Import script is missing definition for 'file'\");\n        }\n        if (!$attributes || !is_array($attributes)) {\n            throw new SystemException(\"Import script is missing definition for 'attributes'\");\n        }\n\n        if (!class_exists($className)) {\n            throw new SystemException(\"Import class '{$className}' does not exist.\");\n        }\n\n        $importFile = $this->themePath . '/' . $fileName;\n        if (!File::exists($importFile)) {\n            throw new SystemException(\"Import file '{$fileName}' does not exist.\");\n        }\n\n        $importModel = new $className;\n        $importModel->forceFill($attributes);\n\n        if (method_exists($importModel, 'setSourcePrefix')) {\n            $importModel->setSourcePrefix($this->themePath);\n        }\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/models/ThemeSeed.php#L202-L238","documentation":"The third required key in a seeds/data.yaml instruction is 'attributes', and it must be a non-empty array (it is force-filled onto the importer). The check throws both when the key is missing/null and when it is present but scalar - so attributes: title fails exactly like omitting it.","triggerScenarios":"A data.yaml entry where attributes is absent, null, a plain string (attributes: title), or an empty list, processed by theme:seed.","commonSituations":"Authors expecting attributes to be optional; writing a comma string instead of a YAML sequence; indentation errors that turn the sequence into a scalar.","solutions":["Provide attributes as a YAML sequence of column names: attributes: [title, slug, content].","If the importer truly needs no attributes, check its implementation - this schema requires a non-empty array regardless.","Re-run php artisan theme:seed <theme>."],"exampleFix":"# before - scalar form fails is_array check\n- class: 'Acme\\Blog\\Classes\\PostImport'\n  file: seeds/posts.yaml\n  attributes: title\n\n# after - sequence form\n- class: 'Acme\\Blog\\Classes\\PostImport'\n  file: seeds/posts.yaml\n  attributes: [title, slug, content]","handlingStrategy":"validation","validationCode":"foreach ((array) Yaml::parseFile($themePath . '/seeds/data.yaml') as $i => $ins) {\n    if (empty($ins['attributes']) || !is_array($ins['attributes'])) {\n        $errors[] = \"instruction {$i}: 'attributes' must be a non-empty array\";\n    }\n}","typeGuard":"function isCompleteSeedInstruction(array $i): bool\n{\n    return isset($i['attributes']) && is_array($i['attributes']) && $i['attributes'] !== [];\n}","tryCatchPattern":"try {\n    \\Artisan::call('theme:seed', ['name' => $themeDir]);\n} catch (\\October\\Rain\\Exception\\SystemException $e) {\n    // convert scalar attributes to a YAML sequence, then re-seed\n}","preventionTips":["Always write attributes as a YAML sequence: [title, slug].","Never leave attributes empty - the schema demands a non-empty array.","Lint seeds/data.yaml in CI for key types, not just key presence."],"tags":["theme-seed","yaml","config-validation","type-mismatch"],"backgroundTag":"missing-required-config-key","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}