crowdsecurity/crowdsec · error

%s:%s has no stage

Error message

%s:%s has no stage

What it means

parseIndex requires parsers and postoverflows items to declare a Stage (e.g. s00-raw, s01-parse), because these item types are organized by stage directories and loading/execution order depends on it. Entries missing a stage are rejected at hub load time.

Source

Thrown at pkg/cwhub/hub.go:94

	if err := json.Unmarshal(bidx, &h.items); err != nil {
		return fmt.Errorf("failed to parse index: %w", err)
	}

	// Iterate over the different types to complete the struct
	for _, itemType := range ItemTypes {
		for name, item := range h.GetItemMap(itemType) {
			if item == nil {
				// likely defined as empty object or null in the index file
				return fmt.Errorf("%s:%s has no index metadata", itemType, name)
			}

			if item.RemotePath == "" {
				return fmt.Errorf("%s:%s has no download path", itemType, name)
			}

			if (itemType == PARSERS || itemType == POSTOVERFLOWS) && item.Stage == "" {
				return fmt.Errorf("%s:%s has no stage", itemType, name)
			}

			item.hub = h
			item.Name = name

			item.Type = itemType
			item.FileName = path.Base(item.RemotePath)

			item.logMissingSubItems()

			if item.latestHash() == "" {
				h.logger.Errorf("invalid hub item %s: latest version missing from index", item.FQName())
			}
		}
	}

	return nil
}

View on GitHub (pinned to 909b515798)

Solutions

  1. Set the `stage` field on the index entry (e.g. "s01-parse")
  2. Re-run `cscli hub update` to regenerate the index
  3. Move the parser file into a properly staged directory and reinstall via `cscli hub`
  4. Only collections/parsers/postoverflows need stages — verify the item's type is correct

Example fix

// before
"crowdsecurity/my-parser": {"type":"parsers","remote_path":"parsers/crowdsecurity/my-parser.yaml"}
// after
"crowdsecurity/my-parser": {"type":"parsers","stage":"s02-enrich","remote_path":"parsers/s02-enrich/crowdsecurity/my-parser.yaml"}
Defensive patterns

Strategy: validation

Validate before calling

if (itemType == cwhub.PARSERS || itemType == cwhub.POSTOVERFLOWS) && item.Stage == "" {
    return fmt.Errorf("%s:%s needs a stage", itemType, name)
}

Prevention

When it happens

Trigger: Hub.Load()/parseIndex encounters an index entry of type PARSERS or POSTOVERFLOWS whose Stage field is empty — usually a manually written index entry or an index generated by a version that didn't record stages.

Common situations: Adding a custom parser entry to .index.json by hand without a stage key; migrating an old hub index; scripted index generation that omits optional fields.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/a12906576e24bcb4. Report an issue: GitHub.