gohugoio/hugo · error

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

Error message

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

What it means

`IndexConfig.ToKeywords` (related/inverted_index.go:427) converts a front matter value into search keywords for a related index. It supports string, []string, []any (of strings), time.Time and nil; any other Go type (maps, numbers, bools, structs) hits the default case and fails because Hugo doesn't know how to index it.

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 8a468df065)

Solutions

  1. Change the front matter param used by the index to a string or list of strings on every page (e.g. `series: ["2024"]` instead of `series: 2024`).
  2. Point the related index at a different, string-valued param, or remove the index from `related.indices`.
  3. If dates are intended, use a date-typed param — time.Time is supported (formatted with the index `pattern`, default `2006`).

Example fix

# before (front matter)
author:
  name: Jane
# after
authors: ["jane"]  # and point related.indices at 'authors'
Defensive patterns

Strategy: type-guard

Validate before calling

# Ensure the front matter value for an indexed key is a supported type
# strings, string slices, or dates — not maps or nested objects
tags: ["go", "hugo"]  # ok
# tags: {name: go}    # NOT indexable

Type guard

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

Try / catch

if err := idx.Add(ctx, doc); err != nil {
    return fmt.Errorf("page %s has un-indexable value for a related index (check front matter types): %w", doc.Name(), err)
}

Prevention

When it happens

Trigger: A page's front matter param used as a related index holds an unsupported type — e.g. `related.indices` includes `name = 'author'` but pages set `author` to a map (`author: {name: ...}`), a number, or a bool; the error fires during indexing or when querying keywords for a document.

Common situations: Configuring a related index over a param that some pages define as a map/object; taxonomy-like params stored as numbers (`series: 2024`); mixing scalar and structured values for the same param across pages.

Related errors


AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31). Data as JSON: /data/errors/bc0f1885663c25cc.json. Report an issue: GitHub ↗.