RyanCodrai/turbovec · error · ValueError

namespace must be a non-empty name, got {namespace!r}

Error message

namespace must be a non-empty name, got {namespace!r}

What it means

Raised in _validate_namespace (called from from_persist_dir) when the namespace is empty or '.'. Such a namespace would name the persist_dir itself rather than a store file when composed into '{namespace}__vector_store.json', so it is rejected before any file access.

Source

Thrown at turbovec-python/python/turbovec/llama_index.py:166

    ``persist_dir`` when composed into a filename.

    ``from_persist_dir`` builds ``{persist_dir}/{namespace}__vector_store.json``.
    A ``namespace`` containing a path separator or ``..`` resolves outside
    ``persist_dir`` (path traversal), an empty/``.`` namespace names the
    directory itself rather than a store file, and a ``:`` forms a
    Windows drive-relative name (``C:foo``) that escapes ``persist_dir``
    without any separator. We reject these loudly rather than silently
    basenaming them — silent rewriting could load a *different* store
    than the caller named. Any other namespace is accepted verbatim
    (alphanumerics, dash, underscore, dots, and other non-separator
    characters); dotted namespaces such as ``v1.2`` map to distinct
    file pairs and coexist in one ``persist_dir``.

    This is a deliberate divergence from ``SimpleVectorStore``, which does
    not sanitize its namespace, in the safer direction.
    """
    if namespace == "" or namespace == ".":
        raise ValueError(
            f"namespace must be a non-empty name, got {namespace!r}"
        )
    if "/" in namespace or "\\" in namespace or os.sep in namespace or ".." in namespace:
        raise ValueError(
            "namespace must not contain path separators ('/' or '\\\\') or "
            f"'..'; got {namespace!r}. It names a store within persist_dir, "
            "not a path."
        )
    if ":" in namespace:
        raise ValueError(
            "namespace must not contain ':' (a Windows drive-relative name "
            f"like 'C:foo' escapes persist_dir); got {namespace!r}. It "
            "names a store within persist_dir, not a path."
        )
    return namespace


def _split_persist_base(persist_path: str | Path) -> Path:

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Pass a non-empty namespace such as 'default' or 'v1.2'.
  2. Check where the namespace value originates — an empty config/env value is a caller bug.
  3. Catch the ValueError in storage bootstrap to report the invalid namespace.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at turbovec-python/python/turbovec/llama_index.py:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06). Data as JSON: /api/errors/ccb87da005b4c3d6. Report an issue: GitHub.