removed the line number in the error message#6736
Merged
lifeizhou-ap merged 1 commit intomainfrom Jan 27, 2026
Merged
Conversation
…recipe template name for minininja
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines recipe error handling and validation to produce friendlier error messages (without line/column numbers) and adds validation coverage for retry configuration.
Changes:
- Centralizes retry configuration validation in
validate_recipe_template_from_contentand adds tests forRetryConfig::validateplus a template build test for invalid retry configs. - Introduces
strip_error_locationto trim serde/YAML/JSON error messages and applies it inRecipe::from_contentanddeserialize_save_recipe_request, updating tests to assert the new error strings. - Adjusts MiniJinja’s internal template name (
CURRENT_TEMPLATE_NAME) to"recipe_template"for clarity and imports/typing in server routes to use the new helper.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/goose/src/recipe/validate_recipe.rs |
Adds validate_retry_config and calls it from validate_recipe_template_from_content so invalid retry configs are caught during recipe/template validation. |
crates/goose/src/recipe/template_recipe.rs |
Renames the internal template name constant to "recipe_template" while keeping all usages consistent. |
crates/goose/src/recipe/mod.rs |
Introduces strip_error_location and uses it to remove serde location info from Recipe::from_content errors; removes inline retry validation from from_content; adds tests asserting the new error message format. |
crates/goose/src/recipe/build_recipe/tests.rs |
Adds a test ensuring build_recipe_from_template surfaces invalid retry configs as a TemplateRendering error with a clear message. |
crates/goose/src/agents/types.rs |
Adds unit tests covering RetryConfig::validate success and failure cases (zero retries and zero timeouts). |
crates/goose-server/src/routes/recipe.rs |
Imports strip_error_location, narrows the type annotation for request in save_recipe, and applies strip_error_location when formatting SaveRecipeRequest deserialization errors to hide line/column details. |
zanesq
approved these changes
Jan 27, 2026
This was referenced Jan 29, 2026
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
Improved recipe error handling and validation to produce friendlier error messages (without line/column numbers)
Why
When user saves or imports recipe, the goose server will deserialise the recipe in the request level and it will show the error of "missing field title: line1 column1". Sometimes the recipe is not provided via a file to call these end points, it could be a deeplink or serialised UI form data, so it does not make sense to include the line number, column number. Even with a recipe file in CLI, since it already specifies the field name in the error message, we don't need the line number, column number.
What
Removed the line number related from error message via parsing (looking for
at line). I was trying to find a better approach like using custom error message but seems the solution is creating a custom deserializer with all the validation. With thecustom deserializer, we have to duplicate the logic of required field, type of data in default serde behaviour for each field. Therefore, I chose to use theparsing error messageapproach which is simplerRenamed the internal template name from
current_templatetorecipe_templateso that it makes a bit more sense in the minininjia error message.Type of Change
AI Assistance
Testing
Unit test and manual test
Related Issues
Relates to #ISSUE_ID
Discussion: LINK (if any)