{"record":{"id":"e023b3329ca09cc1","repo":"mudler/LocalAI","slug":"model-name-is-required","errorCode":null,"errorMessage":"Model name is required","messagePattern":"Model name is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"core/http/views/model-editor.html","lineNumber":1069,"sourceCode":"\n# Use cases\n# known_usecases:\n#   - chat\n#   - completion\n`;\n        },\n        \n        validateConfig() {\n            try {\n                const yamlContent = this.yamlEditor.getValue();\n                const config = jsyaml.load(yamlContent);\n                \n                if (!config || typeof config !== 'object') {\n                    throw new Error('Invalid YAML structure');\n                }\n                \n                if (!config.name) {\n                    throw new Error('Model name is required');\n                }\n                const isPipeline = config.pipeline && (config.pipeline.vad || config.pipeline.transcription || config.pipeline.tts || config.pipeline.llm);\n                if (!isPipeline && !config.backend) {\n                    throw new Error('Backend is required');\n                }\n                if (!isPipeline && (!config.parameters || !config.parameters.model)) {\n                    throw new Error('Model file/path is required in parameters.model');\n                }\n                \n                this.showAlert('success', 'Configuration is valid!');\n            } catch (error) {\n                this.showAlert('error', 'Validation failed: ' + error.message);\n            }\n        },\n        \n        async saveConfig() {\n            try {\n                const yamlContent = this.yamlEditor.getValue();","sourceCodeStart":1051,"sourceCodeEnd":1087,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/core/http/views/model-editor.html#L1051-L1087","documentation":"Thrown by validateConfig() when the parsed YAML mapping has no name key (or name is empty/null). The model name is the identifier LocalAI uses for the config file and API references, so validation stops before checking backend and parameters.model.","triggerScenarios":"A config like 'backend: llama.cpp\\nparameters:\\n  model: foo.gguf' with no 'name:' line, or 'name:' with an empty value.","commonSituations":"Copying a fragment of a model config without its header; renaming by deleting the name line; YAML indentation putting name under another key.","solutions":["Add a top-level 'name: <unique-model-id>' line","Ensure name is not nested under another key due to indentation","Pick a name unique among installed models to avoid collisions on save"],"exampleFix":"# before\nbackend: llama.cpp\nparameters:\n  model: /models/foo.gguf\n\n# after\nname: my-model\nbackend: llama.cpp\nparameters:\n  model: /models/foo.gguf","handlingStrategy":"validation","validationCode":"function hasModelName(config) {\n  return isModelMapping(config) && typeof config.name === 'string' && config.name.trim().length > 0\n}","typeGuard":"function hasModelName(config) {\n  return isModelMapping(config) && typeof config.name === 'string' && config.name.trim().length > 0\n}","tryCatchPattern":"try {\n  if (!hasModelName(config)) throw new Error('Model name is required')\n} catch (error) {\n  this.showAlert('error', 'Validation failed: ' + error.message)\n}","preventionTips":["Keep 'name:' as the first line of every model config","Give the name a unique slug matching installed models' naming to avoid collisions","Watch indentation — a nested name silently fails this check"],"tags":["yaml","validation","legacy-ui","model-config"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}