Improve schedule YAML missing-file errors by surfacing a direct validation failure#46906
Draft
Copilot wants to merge 4 commits into
Draft
Improve schedule YAML missing-file errors by surfacing a direct validation failure#46906Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/366c4e6f-aa9c-4246-b4e2-db383393cc01 Co-authored-by: lavakumarrepala <221403938+lavakumarrepala@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/366c4e6f-aa9c-4246-b4e2-db383393cc01 Co-authored-by: lavakumarrepala <221403938+lavakumarrepala@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-python/sessions/366c4e6f-aa9c-4246-b4e2-db383393cc01 Co-authored-by: lavakumarrepala <221403938+lavakumarrepala@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix file not found error in schedule creation
Improve schedule YAML missing-file errors by surfacing a direct validation failure
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.
When
create_jobpoints to a non-existent local YAML (for example, a wrongpipeline.ymlpath), schedule loading currently emits a deeply nested multi-schema validation blob instead of a direct actionable error. This change makes missing file references fail early with a clear message.Error normalization at file-ref source
FileRefField._deserializeto catchFileNotFoundError/OSErrorfromload_file(...)and raise a marshmallowValidationErrorwith a consistent"No such file or directory: <path>"message.Union fallback short-circuit for missing local files
UnionField._deserializeto stop aggregating alternative schema errors once a file-not-found validation message is present, preventing noisy cascaded errors from unrelated union branches.Schedule regression coverage
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 366c4e6f-aa9c-4246-b4e2-db383393cc01 --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 or non-existent
pipeline.ymlpath, the SDK throws a confusing, deeply nested JSON validation error like:{ "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"]] }, ... ] }This is tracked in ICM incident 594180941.
Root Cause
In
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py, theFileRefField._deserializemethod callsload_file(path)without catchingFileNotFoundError:When the file doesn't exist,
load_file(path)raises a rawFileNotFoundError(an OS exception). Since this is not amarshmallow.ValidationError, it is not cleanly caught byUnionField._deserialize. Instead, it falls through and tries every possible schema option (ArmStr, CreateJobFileRefField, etc.), collecting all their error messages. The outerJobScheduleSchemathen tries allcreate_jobschema variants (PipelineCreateJobSchema,CommandCreateJobSchema,SparkCreateJobSchema), each of which repeats the cascade — resulting in the deeply nested, repetitive error structure.Note:
UnionField._deserializealready has aexcept (FileNotFoundError, TypeError)handler that catches these and adds a formatted trace message. However, the fix should be at the source — inFileRefField._deserialize— to give a clean, actionable error message immediately, rather than relying on the catch-all inUnionField.Fix
In
FileRefField._deserializeinsdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py, wrap theload_file(path)call with atry/exceptto convertFileNotFoundError/OSErrorinto amarshmallow.ValidationErrorwith a clear message:This ensures marshmallow catches the error cleanly, short-circuits the union field fallback loop, and surfaces exactly one, human-readable error message to the user.
Files to Change
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py— UpdateFileRefField._deserializeto wrapload_file(path)withtry/except (FileNotFoundError, OSError)and raiseValidationError.Testing
Add or update unit tests in the schedule test file (
sdk/ml/azure-ai-ml/tests/schedule/unittests/test_schedule_entity.py) to assert that when a schedule YAML references a non-existent pipeline file, the error raised is a clearValidationErrorcontaining"No such file or directory"— and NOT the deeply nested multi-schema error blob.The 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/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.MachineLearningServices/workspaces/<workspace_name>/jobs\n2. The short-hand name of the resource registered in the workspace, eg: azureml::. For example, version 1 of the environment r...
This pull request was created from Copilot chat.