mlflow/mlflow · error · ValueError

❌ Invalid field path(s): {error_msg with invalid paths, dot-

Error message

❌ Invalid field path(s):
{error_msg with invalid paths, dot-notation guidance, and available field suggestions}

What it means

validate_field_paths() checks each requested field path (dot notation like info.trace_id) against sample trace data via jsonpath extraction. Any path that yields no values is reported, and a ValueError is raised listing the invalid paths, dot-notation guidance, available fields in the data, and a hint to use --verbose. It is a user-input validation helper for trace search/export field selection.

Source

Thrown at mlflow/utils/jsonpath_utils.py:307

                # Group by top-level key for better readability
                info_fields = [f for f in available_fields if f.startswith("info.")]
                data_fields = [f for f in available_fields if f.startswith("data.")]

                if info_fields:
                    error_msg += f"   info.*: {', '.join(info_fields[:8])}"
                    if len(info_fields) > 8:
                        error_msg += f", ... (+{len(info_fields) - 8} more)"
                    error_msg += "\n"

                if data_fields:
                    error_msg += f"   data.*: {', '.join(data_fields[:5])}"
                    if len(data_fields) > 5:
                        error_msg += f", ... (+{len(data_fields) - 5} more)"
                    error_msg += "\n"

                error_msg += "\n💡 Tip: Use --verbose flag to see all available fields"

        raise ValueError(error_msg)


def get_available_field_suggestions(data: dict[str, Any], prefix: str = "") -> list[str]:
    """Get a list of available field paths for suggestions."""
    paths = []

    def collect_paths(obj, current_path=""):
        if isinstance(obj, dict):
            for key, value in obj.items():
                path = f"{current_path}.{key}" if current_path else key
                paths.append(path)
                # Only go 2 levels deep for suggestions to keep it manageable
                if current_path.count(".") < 2:
                    collect_paths(value, path)
        elif isinstance(obj, list) and obj:
            # Show array notation but don't expand all indices
            path = f"{current_path}.*" if current_path else "*"
            if path not in paths:

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Run again with verbose=True (or --verbose) to see the full list of available fields and pick valid ones
  2. Fix the dot-notation paths to match the schema, e.g. info.trace_id, info.state, data.spans, info.assessments.*
  3. Remove the invalid paths from the fields list and re-run, or start with fields=None to get the default set
  4. Check the trace data of your experiment (a sample trace) to confirm which fields actually exist before filtering

Example fix

// before
client.search_traces(experiment_id="1", fields=["trace_id", "info.spans"])  # ValueError
// after
client.search_traces(experiment_id="1", fields=["info.trace_id", "data.spans"])
Defensive patterns

Strategy: validation

Validate before calling

from mlflow.utils.jsonpath_utils import get_available_field_suggestions
valid = set(get_available_field_suggestions(sample_trace))
requested = {'info.trace_id', 'data.spans'}
bad = [p for p in requested if p not in valid and '*' not in p]
assert not bad, f'Invalid field paths: {bad}; available: {sorted(valid)[:20]}'

Type guard

def is_valid_field_path(path: str, sample: dict) -> bool:
    return '*' in path or bool(jsonpath_extract_values(sample, path))

Try / catch

try:
    traces = client.search_traces(experiment_id=exp_id, fields=fields)
except ValueError as e:
    if 'Invalid field path' in str(e):
        print(e)  # message lists available fields; fix and retry
    else:
        raise

Prevention

When it happens

Trigger: Calling mlflow.search_traces(..., fields=[...]) or get_trace with field paths that do not resolve in the trace schema: misspelled names (info.trace_idd), wrong casing, referencing nested fields that don't exist in these traces, or paths missing the info./data. prefix. Wildcard paths are skipped, so only concrete bad paths trigger this.

Common situations: Copy-pasting field lists from docs of a different MLflow version; assuming assessments/tags exist on all traces; using OpenTelemetry-style names instead of MLflow's info./data. schema; CLI usage without --verbose so the suggestions list is truncated.

Related errors


AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29). Data as JSON: /api/errors/bcffa3c0ca9a5590. Report an issue: GitHub.