{"record":{"id":"834bfda53ba6a8ba","repo":"microsoft/semantic-kernel","slug":"field-filter-one-field-is-not-a-valid-field-in","errorCode":null,"errorMessage":"Field \"{filter_one_field}\" is not a valid field in the artifact.","messagePattern":"Field \"(.+?)\" is not a valid field in the artifact\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/samples/demos/guided_conversations/guided_conversation/plugins/artifact.py","lineNumber":219,"sourceCode":"            for name, property_dict in properties.items():\n                if name not in failed_fields:\n                    cleaned_property = {}\n                    for k, v in property_dict.items():\n                        if k in [\"title\", \"default\"]:\n                            continue\n                        cleaned_property[k] = v\n                    clean_properties[name] = cleaned_property\n\n            clean_properties_str = str(clean_properties)\n            clean_properties_str = clean_properties_str.replace(\"$ref\", \"type\")\n            clean_properties_str = clean_properties_str.replace(\"#/$defs/\", \"\")\n            return clean_properties_str\n\n        # If filter_one_field is provided, only get the schema for that one field\n        if filter_one_field:\n            if not self._is_valid_field(filter_one_field):\n                self.logger.error(f'Field \"{filter_one_field}\" is not a valid field in the artifact.')\n                raise ValueError(f'Field \"{filter_one_field}\" is not a valid field in the artifact.')\n            filtered_schema = {\"properties\": {filter_one_field: self.original_schema[\"properties\"][filter_one_field]}}\n            filtered_schema.update((k, v) for k, v in self.original_schema.items() if k != \"properties\")\n            schema = filtered_schema\n        else:\n            schema = self.original_schema\n\n        failed_fields = self.get_failed_fields()\n        properties = _clean_properties(schema, failed_fields)\n        if not properties:\n            self.logger.error(\"No properties found in the schema.\")\n            raise ValueError(\"No properties found in the schema.\")\n\n        types_schema = schema.get(\"$defs\", {})\n        custom_types = []\n        for type_name, type_info in types_schema.items():\n            if f\"'type': '{type_name}'\" in properties:\n                clean_schema = _clean_properties(type_info, [])\n                if clean_schema != \"{}\":","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/samples/demos/guided_conversations/guided_conversation/plugins/artifact.py#L201-L237","documentation":"Raised by Artifact.get_schema (or filtered schema accessor) when filter_one_field is supplied but _is_valid_field returns False — the requested field is not present in original_schema['properties']. It is a guard to prevent the LLM from requesting schema for a non-existent artifact field.","triggerScenarios":"Calling get_schema(filter_one_field='<name>') with a name not defined in the artifact's JSON schema properties; the schema was modified/extended but the field name wasn't added; a typo in the field name.","commonSituations":"The LLM hallucinates a field name; the artifact schema differs between versions; case mismatch in field names.","solutions":["Inspect original_schema['properties'].keys() to list valid field names before calling.","Pass an existing field name to filter_one_field.","Call get_schema() without filter_one_field to get the full schema.","Update the artifact schema to include the new field if it is legitimately missing."],"exampleFix":"// before\nartifact.get_schema(filter_one_field='title')  # not a real field\n\n// after\nvalid = set(artifact.original_schema['properties'].keys())\nfield = 'title' if 'title' in valid else next(iter(valid))\nartifact.get_schema(filter_one_field=field)","handlingStrategy":"validation","validationCode":"valid_fields = set(artifact.original_schema.get('properties', {}).keys())\nif filter_one_field and filter_one_field not in valid_fields:\n    raise ValueError(f'Invalid field. Valid: {sorted(valid_fields)}')\nartifact.get_schema(filter_one_field=filter_one_field)","typeGuard":"def is_valid_artifact_field(artifact, field: str) -> bool:\n    return field in artifact.original_schema.get('properties', {})","tryCatchPattern":"try:\n    schema = artifact.get_schema(filter_one_field=field)\nexcept ValueError:\n    schema = artifact.get_schema()  # full schema fallback","preventionTips":["Expose valid field names to the model in the prompt.","Validate against original_schema['properties'] before filtering.","Fall back to the full schema when the requested field is unknown."],"tags":["guided-conversation","artifact","schema","validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}