ErrLookup › Background articles › "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries
"must not be empty", "cannot be empty" — required-field validation errors across open-source libraries
"must not be empty", "cannot be empty", and "X is required" errors come from a library's validation guard that rejects a required field when it is missing, an empty string, or only whitespace. Developers hit them when an unset variable, a blank form field, a templated config that stripped a value, or a struct literal with zero-valued fields flows into an API call. Fixing them means finding which field the message names and supplying a real value at the source.
Distilled from 101 documented records across 41 repositories.
Background
These errors are produced at the input-validation boundary of a library or service: a constructor, request handler, config loader, or webhook checks that a mandatory field is present and non-blank before doing any work. The check is almost always a trim-then-test — strings.TrimSpace(request.Text) == "" in beads' comment validation, trim() in zeroclaw's identity persistence, validate_lark_marker_target trimming before any scheme check. That means whitespace-only values are treated exactly like empty ones, which surprises callers who assumed a string of spaces or newlines counts as content. The guard exists because an empty value is rarely a meaningful request: Chroma refuses {"keys": []} in a group_by because zero grouping dimensions is indistinguishable from 'no grouping', which must instead be expressed by omitting group_by or passing {}; gitbutler aborts review creation because a forge requires a title; beads refuses whitespace-only comments because they almost always indicate a shell quoting accident.
From the caller's side these errors usually name the offending field, sometimes with structured detail. zeroclaw's "{field} cannot be empty" reports the first blank field in a fixed order (sop_name, then procedure_markdown, then description); mise's "workspace {kind} ID cannot be empty" tells you whether the provider or project half of a provider:local pair was blank; CodeWhale's ensure_safe_storage_id names the exact kind ('automation id', 'run id', and so on). The error is often deliberately early — Claim in beads validates before opening a transaction because an empty-ID claim can never match a row; zeroclaw's create_proposal validates before leak scanning; zeroclaw's Lark marker validation fires before scheme or workspace checks. So the fix belongs at the value's origin, not where the error surfaces.
Where the empty value comes from is the interesting part. Common origins are optional CLI flags and struct fields defaulted to empty strings, template or YAML merging that stripped entries yet kept the parent object (commented-out YAML keys producing an empty list), i18n lookups returning empty strings for missing locales, QR-pairing or parsing pipelines that extracted nothing, and JSON decoders passing nil bytes to an UnmarshalText (cilium's RuleIPOrCIDR rejects nil outright). Because the message rarely shows the caller the raw value, debugging means tracing upstream to the producer of the empty string rather than retrying.
Behavior around empty values is library-specific and worth checking per record. Chroma makes {} legal — meaning 'no grouping' — for GroupBy.from_dict while Aggregate.from_dict rejects an empty dict, and Select accepts an empty keys list that Aggregate rejects. Excel libraries differ too: excelize treats CustomNumFmt as set only when the pointer is non-nil, so the error fires only for a non-nil pointer to an empty string, while PhpSpreadsheet's Worksheet setCodeName rejects any empty code name but happily generates one when you never call it. Some libraries would rather you omit the field entirely than pass an empty value — CodeWhale tells you to drop a blank provider key so the launch path resolves it from config instead.
Common causes
- Unassigned or zero-value fields. A struct literal, optional CLI flag, or uninitialized variable defaults to the empty string and is passed straight through: ClaimRequest{} with Actor and IssueID unset in beads, a Link built without setting Type in cilium, a PHP variable initialized but never assigned. Validation fires because the producer never populated the field.
- Blank or whitespace-only input. Users or scripts submit values that are empty or only spaces/newlines: a cleared rename dialog in AnotherRedisDesktopManager, Text: " " in a beads comment, whitespace-only branch names in CodeWhale. Because validators trim first, " " is rejected exactly like "".
- Templates and config merging stripping values. Templating or merge steps emit an empty placeholder instead of omitting the field: YAML where all entries were commented out yielding keys: [], config sections left blank producing aggregate: {} in Chroma, Helm-rendered manifests with empty names in kubesphere. The parent object survives while the value is gone.
- Computed values that evaluated to empty. A dynamic list or lookup produced nothing: a group-by field variable that was blank, an i18n lookup returning an empty string for a missing locale key, ecosystem metadata (a go.mod module path) parsing to empty in mise. The builder forwards the empty result instead of failing or omitting.
- Upstream extraction produced nothing. A parsing or pairing pipeline extracted no identifier: a QR pairing whose phone number/wxid came back empty in zeroclaw, an editor writing nothing (a misconfigured $EDITOR like `true`) leaving gitbutler's review title blank, a model-emitted media marker with no target. The real bug is upstream of the validation error.
- Wrong representation of 'no value'. Some APIs distinguish 'empty value' from 'absent field' and reject the former: CodeWhale profiles must omit the provider key rather than write provider = "", excelize requires CustomNumFmt to be nil rather than a pointer to "", cilium's UnmarshalText rejects nil bytes. Passing an explicit empty where omission is expected triggers the guard.
What usually fixes it
- [object Object]
- [object Object]
- [object Object]
- [object Object]
- [object Object]
Documented occurrences
- Could not serialize collection configuration (chroma-core/chroma)
- No API key provided (chroma-core/chroma)
- ${respBody?.message} (chroma-core/chroma)
- invalid-request: ${label} must be non-empty (ruvnet/ruflo)
- Lark/Feishu marker target is empty (zeroclaw-labs/zeroclaw)
- link type is empty (temporalio/temporal)
- model_provider reference must not be empty (zeroclaw-labs/zeroclaw)
- this.$t('message.group_name_required') (qishibo/AnotherRedisDesktopManager)
- %w: comment text cannot be empty (gastownhall/beads)
- config.description must not be empty (siyuan-note/siyuan)
- workspace {kind} ID cannot be empty (jdx/mise)
- cms::lang.asset.name_cant_be_empty (octobercms/october)
- Cannot persist empty {channel_type} identity (zeroclaw-labs/zeroclaw)
- candidate SOP has no parsed steps (zeroclaw-labs/zeroclaw)
- browser/eval: script must not be empty (ruvnet/ruflo)
- {kind} must not be empty (Hmbown/CodeWhale)
- VerifyCommit committed_tokens must be non-empty: request_id={self.request_id} pre_verify_committed_len={self.pre_verify_committed_len} (sgl-project/sglang)
- nodeId is empty (cilium/cilium)
- Sheet code name cannot be empty. (PHPOffice/PhpSpreadsheet)
- {field} cannot be empty (zeroclaw-labs/zeroclaw)
…and 81 more across the corpus — use search.
Honest provenance: generated on 2026-09-04 from AI-assisted analysis of the linked records. See how records are made.