gastownhall/beads · error

mol_type only supports = operator

Error message

mol_type only supports = operator

What it means

Thrown when the `mol_type` field is compared with an operator other than `=`. Molecule-type filtering only supports equality against a valid MolType value.

Source

Thrown at internal/query/evaluator.go:489

		boolVal = false
	default:
		return fmt.Errorf("invalid boolean value for %s: %s", field, comp.Value)
	}

	switch field {
	case "pinned":
		filter.Pinned = &boolVal
	case "ephemeral":
		filter.Ephemeral = &boolVal
	case "template":
		filter.IsTemplate = &boolVal
	}
	return nil
}

func (e *Evaluator) applyMolTypeFilter(comp *ComparisonNode, filter *types.IssueFilter) error {
	if comp.Op != OpEquals {
		return fmt.Errorf("mol_type only supports = operator")
	}
	mt := types.MolType(strings.ToLower(comp.Value))
	if !mt.IsValid() {
		return fmt.Errorf("invalid mol_type: %s", comp.Value)
	}
	filter.MolType = &mt
	return nil
}

// applyMetadataFilter handles metadata.<key>=<value> queries (GH#1406).
func (e *Evaluator) applyMetadataFilter(comp *ComparisonNode, filter *types.IssueFilter) error {
	if comp.Op != OpEquals {
		return fmt.Errorf("metadata fields only support = operator")
	}
	key := strings.TrimPrefix(comp.Field, "metadata.")
	if err := storage.ValidateMetadataKey(key); err != nil {
		return err
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Use `mol_type = <type>` (e.g. the exact molecule type literal).
  2. For exclusion, use top-level negation if available or filter client-side.
  3. Check MolType.IsValid()-accepted values to know the exact literals.

Example fix

// before
bd list 'mol_type ~ mol*'
// after
bd list 'mol_type = molecule'
Defensive patterns

Strategy: validation

Validate before calling

func validateMolTypeComparison(op string) error {
	if op != "=" {
		return fmt.Errorf("mol_type supports only =, got %q", op)
	}
	return nil
}

Prevention

When it happens

Trigger: Queries like `mol_type != molecule`, `mol_type ~ mol*`, or `mol_type > x` reaching applyMolTypeFilter.

Common situations: Trying prefix or exclusion matching on mol_type; assuming it supports the same operators as text fields; old queries written before the field existed.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/121a41aa21246808. Report an issue: GitHub.