{"record":{"id":"2904e9b4632e98b7","repo":"semaphoreui/semaphore","slug":"invalid-inventory-type","errorCode":null,"errorMessage":"invalid inventory type","messagePattern":"invalid inventory type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/tasks/local_executor.go","lineNumber":459,"sourceCode":"\tinputs = make(map[string]string)\n\n\tplaybookName := t.Task.Playbook\n\tif playbookName == \"\" {\n\t\tplaybookName = t.Template.Playbook\n\t}\n\n\tvar inventoryFilename string\n\tswitch t.Inventory.Type {\n\tcase db.InventoryFile:\n\t\tif t.Inventory.RepositoryID == nil {\n\t\t\tinventoryFilename = t.Inventory.GetFilename()\n\t\t} else {\n\t\t\tinventoryFilename = path.Join(t.tmpInventoryFullPath(), t.Inventory.GetFilename())\n\t\t}\n\tcase db.InventoryStatic, db.InventoryStaticYaml:\n\t\tinventoryFilename = t.tmpInventoryFullPath()\n\tdefault:\n\t\terr = fmt.Errorf(\"invalid inventory type\")\n\t\treturn\n\t}\n\n\targs = []string{\n\t\t\"-i\", inventoryFilename,\n\t}\n\n\tif t.Inventory.SSHKeyID != nil {\n\t\tswitch t.Inventory.SSHKey.Type {\n\t\tcase db.AccessKeySSH:\n\t\t\tif t.sshKeyInstallation.Login != \"\" {\n\t\t\t\targs = append(args, \"--user\", t.sshKeyInstallation.Login)\n\t\t\t}\n\t\tcase db.AccessKeyLoginPassword:\n\t\t\tif t.sshKeyInstallation.Login != \"\" {\n\t\t\t\targs = append(args, \"--user\", t.sshKeyInstallation.Login)\n\t\t\t}\n\t\t\tif t.sshKeyInstallation.Password != \"\" {","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/services/tasks/local_executor.go#L441-L477","documentation":"getPlaybookArgs builds the ansible-playbook command line, including the -i inventory argument. The inventory filename depends on the inventory's type (static, static-yaml, file-based, etc.); a type outside the known enum values hits the default branch and preparation fails with 'invalid inventory type'.","triggerScenarios":"Running/Preparing a task whose Inventory.Type contains an unknown value — a manually inserted DB row, a corrupted type string, or an inventory created by a newer Semaphore version with a type this build does not know.","commonSituations":"Manual database manipulation or migration leftovers; rolling back Semaphore to a version predating a new inventory type (e.g. static-yaml); API clients posting an inventory with a bogus type that passed weak server-side validation.","solutions":["Check the inventory's type field (project inventories in UI or DB table) and set it to a supported value (static, static-yaml, file-based)","Re-create the inventory through the UI/API so the type is set correctly","Upgrade Semaphore to a version that supports the inventory type in use","Restore the type value if it was corrupted by a manual edit or migration"],"exampleFix":"// before (DB row corrupted)\nUPDATE inventory SET type='static-yaml' WHERE id=?; -- was 'custom'\n// after: re-create via API\nPOST /project/{project_id}/inventory {\"name\":\"inv\",\"type\":\"static-yaml\", ...}","handlingStrategy":"validation","validationCode":"switch inventory.Type {\ncase db.InventoryStatic, db.InventoryStaticYaml, db.InventoryFile, db.InventoryLocal:\n    // ok\ndefault:\n    return fmt.Errorf(\"inventory %s has unsupported type %q\", inventory.Name, inventory.Type)\n}","typeGuard":"func inventoryTypeSupported(t db.InventoryType) bool {\n    switch t {\n    case db.InventoryStatic, db.InventoryStaticYaml, db.InventoryFile, db.InventoryLocal:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Create inventories only through the UI/API so type values stay valid","Validate inventory type server-side on create/update","Avoid running an older Semaphore build against inventories made by newer versions","Never hand-edit the inventory type column directly"],"tags":["go","ansible","inventory"],"backgroundTag":"invalid-enum-value","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}