microsoft/semantic-kernel · error · ValueError

Field "{filter_one_field}" is not a valid field in the artif

Error message

Field "{filter_one_field}" is not a valid field in the artifact.

What it means

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.

Source

Thrown at python/samples/demos/guided_conversations/guided_conversation/plugins/artifact.py:219

            for name, property_dict in properties.items():
                if name not in failed_fields:
                    cleaned_property = {}
                    for k, v in property_dict.items():
                        if k in ["title", "default"]:
                            continue
                        cleaned_property[k] = v
                    clean_properties[name] = cleaned_property

            clean_properties_str = str(clean_properties)
            clean_properties_str = clean_properties_str.replace("$ref", "type")
            clean_properties_str = clean_properties_str.replace("#/$defs/", "")
            return clean_properties_str

        # If filter_one_field is provided, only get the schema for that one field
        if filter_one_field:
            if not self._is_valid_field(filter_one_field):
                self.logger.error(f'Field "{filter_one_field}" is not a valid field in the artifact.')
                raise ValueError(f'Field "{filter_one_field}" is not a valid field in the artifact.')
            filtered_schema = {"properties": {filter_one_field: self.original_schema["properties"][filter_one_field]}}
            filtered_schema.update((k, v) for k, v in self.original_schema.items() if k != "properties")
            schema = filtered_schema
        else:
            schema = self.original_schema

        failed_fields = self.get_failed_fields()
        properties = _clean_properties(schema, failed_fields)
        if not properties:
            self.logger.error("No properties found in the schema.")
            raise ValueError("No properties found in the schema.")

        types_schema = schema.get("$defs", {})
        custom_types = []
        for type_name, type_info in types_schema.items():
            if f"'type': '{type_name}'" in properties:
                clean_schema = _clean_properties(type_info, [])
                if clean_schema != "{}":

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Inspect original_schema['properties'].keys() to list valid field names before calling.
  2. Pass an existing field name to filter_one_field.
  3. Call get_schema() without filter_one_field to get the full schema.
  4. Update the artifact schema to include the new field if it is legitimately missing.

Example fix

// before
artifact.get_schema(filter_one_field='title')  # not a real field

// after
valid = set(artifact.original_schema['properties'].keys())
field = 'title' if 'title' in valid else next(iter(valid))
artifact.get_schema(filter_one_field=field)
Defensive patterns

Strategy: validation

Validate before calling

valid_fields = set(artifact.original_schema.get('properties', {}).keys())
if filter_one_field and filter_one_field not in valid_fields:
    raise ValueError(f'Invalid field. Valid: {sorted(valid_fields)}')
artifact.get_schema(filter_one_field=filter_one_field)

Type guard

def is_valid_artifact_field(artifact, field: str) -> bool:
    return field in artifact.original_schema.get('properties', {})

Try / catch

try:
    schema = artifact.get_schema(filter_one_field=field)
except ValueError:
    schema = artifact.get_schema()  # full schema fallback

Prevention

When it happens

Trigger: 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.

Common situations: The LLM hallucinates a field name; the artifact schema differs between versions; case mismatch in field names.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/834bfda53ba6a8ba. Report an issue: GitHub.