Comfy-Org/ComfyUI · error · ValueError

Path is not within input, output, temp, or configured model

Error message

Path is not within input, output, temp, or configured model bases: {file_path}

What it means

Raised by the path-classification helper (used when converting a filesystem path into an asset reference/bucket+relative-path pair) when the given path is not located under any known root: the input directory, output directory, temp directory, or any configured models base. The function walks candidate bases and keeps the longest matching prefix; if none contain the path, it cannot produce a bucket classification and raises ValueError.

Source

Thrown at app/assets/services/path_utils.py:234

        # accepts any extension), so a bucket that cannot load the file
        # must not contribute a loader path.
        if extensions and ext not in extensions:
            continue
        for b in bases:
            base_abs = os.path.abspath(b)
            if not _check_is_within(fp_abs, base_abs):
                continue
            cand = (len(base_abs), bucket, _compute_relative(fp_abs, base_abs))
            if best is None or cand[0] > best[0]:
                best = cand

    if best is not None:
        _, bucket, rel_inside = best
        combined = os.path.join(bucket, rel_inside)
        normalized = os.path.relpath(os.path.join(os.sep, combined), os.sep)
        return "models", normalized.replace(os.sep, "/")

    raise ValueError(
        f"Path is not within input, output, temp, or configured model bases: {file_path}"
    )


def get_backend_system_tags_from_path(path: str) -> list[str]:
    """Return trusted backend tags derived from current filesystem facts.

    The returned tags are only the backend-generated system tags: ``models``,
    ``model_type:<folder_name>``, ``input``, ``output``, and ``temp``. Model
    type tags are based on registered folder names, not path components.

    A ``model_type:<folder_name>`` tag is only emitted when the file's
    extension is accepted by that folder's registered extension set, so
    categories sharing a base directory tag only the files they can
    actually load. Files under a model base whose extension matches no
    category still get the ``models`` tag.
    """
    fp_abs = os.path.abspath(path)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Only classify paths that live under input/, output/, temp/, or a registered models folder — copy or move the file into one first.
  2. Fix folder configuration (extra_model_paths.yaml) so the configured bases match where the files actually reside, then retry.
  3. Check for symlinks: resolve them so the physical location is inside a base, or update the base to point at the physical directory.

Example fix

# before
classify('/home/user/downloads/model.safetensors')  # raises

# after
import shutil
shutil.copy(src, models_checkpoints_dir)
classify(str(models_checkpoints_dir / 'model.safetensors'))
Defensive patterns

Strategy: validation

Validate before calling

# Check containment against the same roots before classifying
def within_any_root(p: str, roots: list[str]) -> bool:
    pa = Path(os.path.abspath(p)).resolve()
    return any(pa.is_relative_to(Path(os.path.abspath(r)).resolve()) for r in roots)

Type guard

def is_classifiable_path(p: str, roots) -> bool:
    return within_any_root(p, roots)

Try / catch

try:
    bucket, rel = classify_path(file_path)
except ValueError:
    skip_or_move(file_path)  # not an asset location; don't index

Prevention

When it happens

Trigger: Calling path-classification with an arbitrary absolute path like '/etc/passwd', '/home/user/somefile.safetensors', or a models file whose folder is registered but whose base path resolves differently (e.g. via symlink); also relative paths that abspath to outside all bases.

Common situations: Registering/importing existing files by path where the user-supplied path points outside ComfyUI's directory tree; symlinks inside models making the realpath land outside the configured base; case or trailing-slash differences in configured bases; stale folder configuration after directories moved.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/b6199cba26e06654. Report an issue: GitHub.