{"record":{"id":"bcffa3c0ca9a5590","repo":"mlflow/mlflow","slug":"invalid-field-path-s-error-msg-with-invalid-p","errorCode":null,"errorMessage":"❌ Invalid field path(s):\n{error_msg with invalid paths, dot-notation guidance, and available field suggestions}","messagePattern":"❌ Invalid field path\\(s\\):\n(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mlflow/utils/jsonpath_utils.py","lineNumber":307,"sourceCode":"                # Group by top-level key for better readability\n                info_fields = [f for f in available_fields if f.startswith(\"info.\")]\n                data_fields = [f for f in available_fields if f.startswith(\"data.\")]\n\n                if info_fields:\n                    error_msg += f\"   info.*: {', '.join(info_fields[:8])}\"\n                    if len(info_fields) > 8:\n                        error_msg += f\", ... (+{len(info_fields) - 8} more)\"\n                    error_msg += \"\\n\"\n\n                if data_fields:\n                    error_msg += f\"   data.*: {', '.join(data_fields[:5])}\"\n                    if len(data_fields) > 5:\n                        error_msg += f\", ... (+{len(data_fields) - 5} more)\"\n                    error_msg += \"\\n\"\n\n                error_msg += \"\\n💡 Tip: Use --verbose flag to see all available fields\"\n\n        raise ValueError(error_msg)\n\n\ndef get_available_field_suggestions(data: dict[str, Any], prefix: str = \"\") -> list[str]:\n    \"\"\"Get a list of available field paths for suggestions.\"\"\"\n    paths = []\n\n    def collect_paths(obj, current_path=\"\"):\n        if isinstance(obj, dict):\n            for key, value in obj.items():\n                path = f\"{current_path}.{key}\" if current_path else key\n                paths.append(path)\n                # Only go 2 levels deep for suggestions to keep it manageable\n                if current_path.count(\".\") < 2:\n                    collect_paths(value, path)\n        elif isinstance(obj, list) and obj:\n            # Show array notation but don't expand all indices\n            path = f\"{current_path}.*\" if current_path else \"*\"\n            if path not in paths:","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/utils/jsonpath_utils.py#L289-L325","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run again with verbose=True (or --verbose) to see the full list of available fields and pick valid ones","Fix the dot-notation paths to match the schema, e.g. info.trace_id, info.state, data.spans, info.assessments.*","Remove the invalid paths from the fields list and re-run, or start with fields=None to get the default set","Check the trace data of your experiment (a sample trace) to confirm which fields actually exist before filtering"],"exampleFix":"// before\nclient.search_traces(experiment_id=\"1\", fields=[\"trace_id\", \"info.spans\"])  # ValueError\n// after\nclient.search_traces(experiment_id=\"1\", fields=[\"info.trace_id\", \"data.spans\"])","handlingStrategy":"validation","validationCode":"from mlflow.utils.jsonpath_utils import get_available_field_suggestions\nvalid = set(get_available_field_suggestions(sample_trace))\nrequested = {'info.trace_id', 'data.spans'}\nbad = [p for p in requested if p not in valid and '*' not in p]\nassert not bad, f'Invalid field paths: {bad}; available: {sorted(valid)[:20]}'","typeGuard":"def is_valid_field_path(path: str, sample: dict) -> bool:\n    return '*' in path or bool(jsonpath_extract_values(sample, path))","tryCatchPattern":"try:\n    traces = client.search_traces(experiment_id=exp_id, fields=fields)\nexcept ValueError as e:\n    if 'Invalid field path' in str(e):\n        print(e)  # message lists available fields; fix and retry\n    else:\n        raise","preventionTips":["Use MLflow's info./data. dot-notation schema, not OpenTelemetry names","Discover fields first with get_available_field_suggestions or --verbose","Avoid hardcoding fields copied from other MLflow versions","Prefer wildcards (info.assessments.*) for optional nested fields"],"tags":["validation","tracing","field-paths","cli"],"backgroundTag":"invalid-field-path","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}