{"record":{"id":"4fbde7678f5381ae","repo":"mlflow/mlflow","slug":"invalid-parameter-value-4fbde7","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"traces must have a 'trace' column like the result of mlflow.search_traces()","messagePattern":"traces must have a 'trace' column like the result of mlflow\\.search_traces\\(\\)","errorType":"error_code","errorClass":"MlflowException","httpStatus":400,"severity":"error","filePath":"mlflow/genai/labeling/labeling.py","lineNumber":184,"sourceCode":"        .. note::\n            This functionality is only available in Databricks. Please run\n            `pip install mlflow[databricks]` to use it.\n\n        Args:\n            traces: Can be either:\n                a) a pandas DataFrame with a 'trace' column. The 'trace' column should contain\n                either `mlflow.entities.Trace` objects or their json string representations.\n                b) an iterable of `mlflow.entities.Trace` objects.\n                c) an iterable of json string representations of `mlflow.entities.Trace` objects.\n\n        Returns:\n            LabelingSession: The updated labeling session.\n        \"\"\"\n        import pandas as pd\n\n        if isinstance(traces, pd.DataFrame):\n            if \"trace\" not in traces.columns:\n                raise MlflowException(\n                    \"traces must have a 'trace' column like the result of mlflow.search_traces()\",\n                    error_code=INVALID_PARAMETER_VALUE,\n                )\n            traces = traces[\"trace\"].to_list()\n\n        trace_list: list[Trace] = []\n        for trace in traces:\n            if isinstance(trace, str):\n                trace_list.append(Trace.from_json(trace))\n            elif isinstance(trace, Trace):\n                trace_list.append(trace)\n            elif trace is None:\n                raise MlflowException(\n                    \"trace cannot be None. Must be mlflow.entities.Trace or its json string \"\n                    \"representation.\",\n                    error_code=INVALID_PARAMETER_VALUE,\n                )\n            else:","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/genai/labeling/labeling.py#L166-L202","documentation":"LabelingSession.add_traces accepts a list of Trace objects, JSON strings, or a pandas DataFrame from mlflow.search_traces(). When a DataFrame is passed, MLflow requires the 'trace' column (search_traces' output format) and raises this error if it is missing.","triggerScenarios":"Passing a DataFrame lacking a 'trace' column to labeling_session.add_traces(df) — e.g. a manually built DataFrame or one from a different API.","commonSituations":"Renaming or dropping columns after search_traces; using a DataFrame from export tools with different column names; constructing traces DataFrame by hand.","solutions":["Pass the DataFrame exactly as returned by mlflow.search_traces().","Rename your column: df = df.rename(columns={'trace_json': 'trace'}) before calling.","Or extract the list yourself: add_traces(df['trace'].to_list()).","Or pass a plain list of Trace objects / JSON strings instead of a DataFrame."],"exampleFix":"// before\nsession.add_traces(df)  # df has 'trace_id' column\n// after\nsession.add_traces(df.rename(columns={'trace_id': 'trace'}))","handlingStrategy":"validation","validationCode":"import pandas as pd\nif isinstance(traces, pd.DataFrame):\n    assert \"trace\" in traces.columns, \"DataFrame must contain 'trace' column\"","typeGuard":"def is_search_traces_df(df) -> bool:\n    import pandas as pd\n    return isinstance(df, pd.DataFrame) and \"trace\" in df.columns","tryCatchPattern":"try:\n    session.add_traces(df)\nexcept MlflowException as e:\n    if \"'trace' column\" in str(e):\n        session.add_traces(df[\"trace_id\"].rename(\"trace\").to_list())","preventionTips":["Pass search_traces() output DataFrames unmodified","Or convert to a list of Trace objects before calling","Avoid renaming/dropping columns on search_traces results"],"tags":["pandas","validation","genai"],"backgroundTag":"missing-required-column","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}