affaan-m/ECC · error · ValueError

asset name must be a simple filename stem (letters, digits…

Error message

asset name must be a simple filename stem (letters, digits, spaces, _.-)

What it means

mint3d.py validates the derived asset name (from --name or the first prompt word) must be a non-empty filename stem of at most 120 chars using only alphanumerics, space, underscore, dash, dot, and must not be '.', '..', or have surrounding whitespace. Violations raise ValueError before any billable API calls.

Solutions

  1. Pass a clean --name using only letters, digits, spaces, '_', '-', '.'
  2. Trim whitespace from the name before invoking
  3. Strip path components: use the basename/stem instead of a full path
  4. Simplify the prompt's first word or explicitly set --name so the prompt is not used for naming

Example fix

// before
python mint3d.py noir --prompt "rusty lamp" --name "assets/hero lamp!"
// after
python mint3d.py noir --prompt "rusty lamp" --name "hero_lamp"
Defensive patterns

Strategy: validation

Validate before calling

import re
if name is not None and not re.fullmatch(r"[\w\-. ]{1,120}", name.strip()):
    raise SystemExit(f"invalid --name: {name!r}")

Type guard

import re
_VALID = re.compile(r"[\w\-. ]{1,120}")
def is_valid_asset_name(name: str) -> bool:
    return name == name.strip() and bool(_VALID.fullmatch(name)) and name not in {".", ".."}

Try / catch

try:
    mint3d(...)
except ValueError as e:
    print(f"bad asset name: {e}"); retry with sanitized name

Prevention

When it happens

Trigger: --name containing slashes, path components, unicode/special characters, leading/trailing whitespace, exceeding 120 chars, being empty, or being '.' or '..'; or a single-word prompt whose first word contains such characters when --name is omitted.

Common situations: Users pass names like 'my/asset', 'hero prop!' or quoted strings with trailing spaces; prompts starting with a punctuation-heavy word become an invalid derived name; names copied with a path prefix from elsewhere.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/f6612abadd989216. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/mint3d.py:70

#
# Generating a clean plate first costs ~$0.15 and is the difference between a
# usable mesh and a discarded one.
PLATE_RULES = (
    "A single isolated object centred on a plain neutral mid-grey seamless "
    "background, filling most of the frame, evenly lit from three quarters, no "
    "other objects, no text, no logos, no props, no shadows cast on the "
    "backdrop, product-photography framing, sharp focus edge to edge, the whole "
    "object visible with nothing cropped. Neutral colour, no colour grading."
)


def _asset_name(name: str | None, prompt: str) -> str:
    words = prompt.split()
    asset = name if name is not None else "prop_" + (words[0] if words else "lifted")
    if (not asset or asset in {".", ".."} or len(asset) > 120
            or any(not (c.isalnum() or c in "_-. ") for c in asset)
            or asset != asset.strip()):
        raise ValueError("asset name must be a simple filename stem (letters, digits, spaces, _.-)")
    return asset


def _check_outputs(sp, asset: str) -> None:
    """Reject existing artifacts for this stem before any billable work."""
    props = sp.dir / "props"
    candidates = [props / f"{asset}{suffix}" for suffix in
                  (".glb", ".json", "_plate.png", "_retopo.glb")]
    candidates += list(props.glob(f"{asset}_part*.glb"))
    candidates += [sp.dir / "turntables" / asset,
                   sp.dir / "turntables" / f"{asset}.mp4"]
    for path in candidates:
        if path.exists() or path.is_symlink():
            raise FileExistsError(f"asset output already exists; choose a new --name: {path}")


def mint3d(
    genre: str,

View on GitHub (pinned to 8321021c54)