HKUDS/Vibe-Trading · error · ValueError

intended_use is required and must be non-empty

Error message

intended_use is required and must be non-empty

What it means

validate_model_registration requires every registered model artifact to declare its intended use. ValueError is raised when intended_use is None/empty or whitespace-only. This is a governance requirement so no model enters the registry without a stated purpose.

Source

Thrown at agent/src/strategy_store/models.py:254

        )


def validate_model_registration(artifact: Artifact) -> None:
    """Validate that *artifact* carries the minimum model-registration fields.

    A model registration without a stated intended use or a stated
    limitation is, for governance purposes, not actually registered — so
    both fields are required and must be non-blank.

    Args:
        artifact: The artifact/model record to validate.

    Raises:
        ValueError: if ``intended_use`` or ``limitations`` is missing or
            consists only of whitespace.
    """
    if not artifact.intended_use or not artifact.intended_use.strip():
        raise ValueError("intended_use is required and must be non-empty")
    if not artifact.limitations or not artifact.limitations.strip():
        raise ValueError("limitations is required and must be non-empty")

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Populate intended_use with a concrete description (e.g. 'daily intraday signal ranking') in the artifact before registering
  2. For bulk imports, validate/fill metadata upstream and fail rows that lack it

Example fix

# before
Artifact(name='m1', universe='u1', intended_use='  ', limitations='...')
# after
Artifact(name='m1', universe='u1', intended_use='daily signal ranking for US equities', limitations='...')
Defensive patterns

Strategy: type-guard

Validate before calling

if not (artifact.intended_use or '').strip():
    artifact.intended_use = source_config.get('purpose') or 'unspecified (legacy import)'

Type guard

def has_intended_use(a) -> bool:
    return bool(a.intended_use and a.intended_use.strip())

Try / catch

try:
    store.register_artifact(artifact)
except ValueError as e:
    if 'intended_use' in str(e): fill the field from metadata and retry once
    else: raise

Prevention

When it happens

Trigger: register_artifact with intended_use='' or ' ' or omitted (defaults empty); programmatic bulk-registration where the field was never populated in source configs.

Common situations: Migrating legacy artifacts whose metadata lacked the field; YAML/JSON registration files missing the key; fixtures that only set limitations.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/9ad5202ea24c2781. Report an issue: GitHub.