semaphoreui/semaphore · error
invalid inventory type
Error message
invalid inventory type
What it means
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'.
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
Example fix
// before (DB row corrupted)
UPDATE inventory SET type='static-yaml' WHERE id=?; -- was 'custom'
// after: re-create via API
POST /project/{project_id}/inventory {"name":"inv","type":"static-yaml", ...} Defensive patterns
Strategy: validation
Validate before calling
switch inventory.Type {
case db.InventoryStatic, db.InventoryStaticYaml, db.InventoryFile, db.InventoryLocal:
// ok
default:
return fmt.Errorf("inventory %s has unsupported type %q", inventory.Name, inventory.Type)
} Type guard
func inventoryTypeSupported(t db.InventoryType) bool {
switch t {
case db.InventoryStatic, db.InventoryStaticYaml, db.InventoryFile, db.InventoryLocal:
return true
}
return false
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- inventory does not exist in inventories[].name
- access key does not suite for inventory's user credentials
- access key does not suite for inventory's sudo user…
- err
- name can not be empty
AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07).
Data as JSON: /api/errors/2904e9b4632e98b7.
Report an issue: GitHub.
Appendix: source
Thrown at services/tasks/local_executor.go:459
inputs = make(map[string]string)
playbookName := t.Task.Playbook
if playbookName == "" {
playbookName = t.Template.Playbook
}
var inventoryFilename string
switch t.Inventory.Type {
case db.InventoryFile:
if t.Inventory.RepositoryID == nil {
inventoryFilename = t.Inventory.GetFilename()
} else {
inventoryFilename = path.Join(t.tmpInventoryFullPath(), t.Inventory.GetFilename())
}
case db.InventoryStatic, db.InventoryStaticYaml:
inventoryFilename = t.tmpInventoryFullPath()
default:
err = fmt.Errorf("invalid inventory type")
return
}
args = []string{
"-i", inventoryFilename,
}
if t.Inventory.SSHKeyID != nil {
switch t.Inventory.SSHKey.Type {
case db.AccessKeySSH:
if t.sshKeyInstallation.Login != "" {
args = append(args, "--user", t.sshKeyInstallation.Login)
}
case db.AccessKeyLoginPassword:
if t.sshKeyInstallation.Login != "" {
args = append(args, "--user", t.sshKeyInstallation.Login)
}
if t.sshKeyInstallation.Password != "" {View on GitHub (pinned to 1774ccb71a)