Normalize missing schedule job file errors to marshmallow ValidationError#46908
Draft
Copilot wants to merge 3 commits into
Draft
Normalize missing schedule job file errors to marshmallow ValidationError#46908Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
… add schedule test Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/6caa9bff-e084-4c8f-affd-c426ef4c1912 Co-authored-by: lavakumarrepala <221403938+lavakumarrepala@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/6caa9bff-e084-4c8f-affd-c426ef4c1912 Co-authored-by: lavakumarrepala <221403938+lavakumarrepala@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve clarity of error message for non-existent pipeline.yml
Normalize missing schedule job file errors to marshmallow ValidationError
May 15, 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.
Creating a schedule with a non-existent
create_jobfile path currently surfaces a deeply nested, multi-schema error blob. The root cause isFileRefFieldleaking rawFileNotFoundError, which causesUnionFieldto continue schema fallthrough and aggregate unrelated errors.Schema error handling
FileRefField._deserializeinsdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.pyto catch filesystem exceptions fromload_file(path)and re-raise asmarshmallow.ValidationError.Schedule regression coverage
sdk/ml/azure-ai-ml/tests/test_configs/schedule/invalid/hello_cron_schedule_with_missing_job_file.ymlsdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_schema.py:test_load_schedule_with_missing_create_job_fileNo such file or directoryand the missing filename.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
centralus-2.in.applicationinsights.azure.com/home/REDACTED/bin/azsdk /home/REDACTED/bin/azsdk ingest-telemetry --client-type copilot-cli --event-type skill_invocation --session-id 6caa9bff-e084-4c8f-affd-c426ef4c1912 --skill-name find-package-skill(dns block)pypi.org/home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python python -m pip install pytest-mock(dns block)scanning-api.github.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Problem
When a user creates a schedule with a wrong/non-existent
pipeline.ymlpath, the resulting error message is an unreadable, deeply nested JSON blob that is confusing and unhelpful. For example:{ "create_job": [ { "_schema": ["In order to specify an existing jobs, please provide either of the following prefixed with 'azureml:'..."] }, { "_schema": ["Not supporting non file for create_job"] }, { "job": [{ "_schema": ["..."] }, ["No such file or directory: CLI\\Pipeline\\..\\pipeline.yml"]] }, { "type": ["Value 'pipeline' passed is not in set ['command']"], "job": [...] }, { "job": [...], "type": ["Value 'pipeline' passed is not in set ['spark']"], "inputs": ["Unknown field."] } ] }Root Cause
In
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py, theFileRefField._deserializemethod callsload_file(path), which raises a rawFileNotFoundError(an OS exception) when the file doesn't exist:Because
FileNotFoundErroris not amarshmallow.ValidationError, theUnionField._deserializehandles it differently (via a separateexcept (FileNotFoundError, TypeError)branch that formats a traceback string) instead of treating it as a clean validation failure. This causesUnionFieldto fall through and try all alternative schema options (ArmStr,CreateJobFileRefField), collecting all their unrelated error messages. The outerJobScheduleSchemathen tries allcreate_jobschema variants (PipelineCreateJobSchema,CommandCreateJobSchema,SparkCreateJobSchema), each repeating the same cascade.Fix
Wrap the
load_file(path)call inFileRefField._deserializewith atry/exceptto catchFileNotFoundError/OSErrorand re-raise as a cleanmarshmallow.ValidationError:File:
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.pyChange
FileRefField._deserializefrom:To:
Expected Outcome
Once
FileNotFoundErroris wrapped as aValidationError:UnionFieldwill catch it as a normal validation failure immediately, without falling through to other schema alternatives"No such file or directory: CLI\Pipeline\..\pipeline.yml"instead of the deeply nested multi-schema error dumpsdk/ml/azure-ai-ml/tests/to verify that providing a non-existent file path in a schedule'screate_jobproduces a clean, single-messageValidationErrorwith the "No such file or directory" messageThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: https://msdata.visualstudio.com/Vienna/_workitems/edit/3957893 can you analye the task and get the requirement here
Assistant: I'm unable to access Azure DevOps work items at
https://msdata.visualstudio.com/Vienna/_workitems/edit/3957893as it's an internal Microsoft URL that requires authentication and is not publicly accessible.To help you analyze the task, please share the work item details directly in the chat — such as the title, description, acceptance criteria, or any relevant notes — and I'll be happy to assist from there.
User: ```
Following is the error message when you create schedule with wrong pipeline.yml path
{
"create_job": [
{
"_schema": [
"In order to specify an existing jobs, please provide either of the following prefixed with 'azureml:':\n1. The full ARM ID for the resource, e.g.azureml:/subscriptions/<subscript...
This pull request was created from Copilot chat.