fix(fs_search): handle empty string file type from LLM tool calls#2355
Merged
amitksingh1490 merged 3 commits intomainfrom Feb 6, 2026
Merged
fix(fs_search): handle empty string file type from LLM tool calls#2355amitksingh1490 merged 3 commits intomainfrom
amitksingh1490 merged 3 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
fs_searchtool crashing with "unrecognized file type" when LLMs send an empty string""for the nullabletypeparameter, by adding empty-string-to-null coercion in the schema coercion layer and a defensive guard in the fs_search tool itself.Context
When LLMs call the
fs_searchtool, they sometimes send"type": ""(an empty string) instead of omitting the parameter or sendingnullfor the nullablefile_typefield. This caused theignorecrate'sTypesBuilder::select("")to fail with:The root issue is that the schema coercion layer (
coerce_to_schema) didn't recognize the OpenAPI 3.0"nullable": trueextension on schema objects, so it had no way to know that an empty string for a nullable field should be converted tonull.Changes
Schema Coercion (
forge_json_repair)is_nullable()helper that checks the"nullable": trueOpenAPI 3.0 extension on schema objects"") toValue::Nullwhen the schema marks a field as nullablefs_search Tool (
forge_services)file_typestrings asNonevia.as_deref().filter(|s| !s.is_empty())Tests
schema_coercion: nullable string, nullable integer, non-empty string preservation, required field preservationfs_search: verifies empty file_type doesn't crash and behaves as unfiltered searchTesting