gohugoio/hugo · error

indexing currently not supported for index

Error message

indexing currently not supported for index %q and type %T

What it means

Returned by IndexConfig.ToKeywords when the value passed for an index is of a Go type that has no keyword conversion rule. Only string, []string, []any, time.Time, and nil are handled; any other concrete type hits the default branch and fails with the offending index name and the value's %T type.

Solutions

  1. Ensure indexed field values are strings, []string, or time.Time before indexing.
  2. Convert numeric/boolean front-matter values to strings at the source, or use a custom Document.RelatedKeywords that returns properly typed Keywords.
  3. Pick index field names that map to string-valued params only.

Example fix

// before: numeric front-matter field used as index
// front matter: weight: 10
// related index "weight" calls ToKeywords(10) -> error

// after: store as string or use a date/keyword field
// front matter: tags: ["heavy", "light"]
// [[related.indices]] name="tags" weight=100
Defensive patterns

Strategy: type-guard

Validate before calling

// Ensure only convertible types reach an index.
func isIndexable(v any) bool {
    switch v.(type) {
    case string, []string, []any, time.Time, nil:
        return true
    }
    return false
}

Type guard

func isIndexableValue(v any) bool {
    switch v.(type) {
    case string, []string, []any, time.Time:
        return true
    case nil:
        return true
    default:
        return false
    }
}

Try / catch

kws, err := cfg.ToKeywords(v)
if err != nil {
    if strings.Contains(err.Error(), "not supported") { /* coerce v to string and retry */ }
}

Prevention

When it happens

Trigger: Calling cfg.ToKeywords(v) with v being e.g. an int, float64, bool, or a custom struct -- i.e. an index field whose page value is a non-string/non-time type. Happens when a Param or front-matter field used as a related index holds a number or boolean.

Common situations: A front-matter field (e.g. weight: 10 as an int) is wired as a related index; a date field parsed as something other than time.Time; a custom Document whose RelatedKeywords returns a value ToKeywords cannot convert.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/bc0f1885663c25cc. Report an issue: GitHub.

Appendix: source

Thrown at related/inverted_index.go:450

		keywords = append(keywords, cfg.stringToKeyword(vv))
	case []string:
		vvv := make([]Keyword, len(vv))
		for i := range vvv {
			vvv[i] = cfg.stringToKeyword(vv[i])
		}
		keywords = append(keywords, vvv...)
	case []any:
		return cfg.ToKeywords(cast.ToStringSlice(vv))
	case time.Time:
		layout := "2006"
		if cfg.Pattern != "" {
			layout = cfg.Pattern
		}
		keywords = append(keywords, StringKeyword(vv.Format(layout)))
	case nil:
		return keywords, nil
	default:
		return keywords, fmt.Errorf("indexing currently not supported for index %q and type %T", cfg.Name, vv)
	}

	return keywords, nil
}

func (idx *InvertedIndex) search(ctx context.Context, query ...queryElement) ([]Document, error) {
	return idx.searchDate(ctx, nil, zeroDate, query...)
}

func (idx *InvertedIndex) searchDate(ctx context.Context, self Document, upperDate time.Time, query ...queryElement) ([]Document, error) {
	matchm := make(map[Document]*rank, 200)
	defer func() {
		for _, r := range matchm {
			putRank(r)
		}
	}()

	applyDateFilter := !idx.cfg.IncludeNewer && !upperDate.IsZero()

View on GitHub (pinned to 52c9bd7908)