Prerequisites
Summary
The CLI reference says exit code 5 means "a resource definition or instance value was invalid against its JSON schema". When a resource instance fails schema validation, dsc exits with 2.
EXIT_VALIDATION_FAILED is still defined in dsc/src/util.rs L73 but nothing uses it, on v3.3.0 or main. Its last use was exit(EXIT_VALIDATION_FAILED) in config validate, removed in 8fff4fbb ("fix merge conflict", 2024-07-25). It looks like that was a side effect of the merge rather than a decision, but I couldn't confirm it.
The same table lists only codes 0 to 6, while util.rs also defines 7 (resource not found), 8 (assertion failed), 9 (server failed) and 10 (Bicep failed).
I don't know which side you'd rather change: return 5 for schema validation errors, or drop 5 from the docs (and add 7 to 10). Either works for me. I script against the exit codes and only need the docs and the binary to agree.
This is not the same as #817 or #1245, which are about exit codes coming back from resources.
Steps to reproduce
-
Save this as repro.dsc.config.yaml. The property name has a typo (valuName). config test doesn't write anything, so the key is never created:
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: typo in property name
type: Microsoft.Windows/Registry
properties:
keyPath: HKCU\Software\DscExitCodeRepro
valuName: Example
-
Run:
dsc config test --file ./repro.dsc.config.yaml
$LASTEXITCODE
Expected behavior
ERROR Schema: Additional properties are not allowed ('valuName' was unexpected)
5
Actual behavior
ERROR Schema: Additional properties are not allowed ('valuName' was unexpected)
2
Other inputs on dsc 3.3.0:
| Input |
Exit |
| unknown resource property (above) |
2 |
wrong property type, valueData: { DWord: "x" } |
2 |
same two cases with dsc resource test -r Microsoft.Windows/Registry |
2 |
| unknown top-level key in the document |
2 |
| invalid YAML |
4 |
parameter default above its maxValue |
4 |
Error details
2026-10-04T10:25:51.959520Z ERROR Schema: Additional properties are not allowed ('valuName' was unexpected)
Environment data
Name Value
---- -----
PSVersion 5.1.26100.9444
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.9444
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Windows 11 Pro for Workstations 25H2, build 26200.
Version
3.3.0 (also reproduced on 3.4.0-preview.1)
Visuals
No response
Prerequisites
Summary
The CLI reference says exit code 5 means "a resource definition or instance value was invalid against its JSON schema". When a resource instance fails schema validation, dsc exits with 2.
EXIT_VALIDATION_FAILEDis still defined indsc/src/util.rsL73 but nothing uses it, on v3.3.0 or main. Its last use wasexit(EXIT_VALIDATION_FAILED)inconfig validate, removed in 8fff4fbb ("fix merge conflict", 2024-07-25). It looks like that was a side effect of the merge rather than a decision, but I couldn't confirm it.The same table lists only codes 0 to 6, while
util.rsalso defines 7 (resource not found), 8 (assertion failed), 9 (server failed) and 10 (Bicep failed).I don't know which side you'd rather change: return 5 for schema validation errors, or drop 5 from the docs (and add 7 to 10). Either works for me. I script against the exit codes and only need the docs and the binary to agree.
This is not the same as #817 or #1245, which are about exit codes coming back from resources.
Steps to reproduce
Save this as
repro.dsc.config.yaml. The property name has a typo (valuName).config testdoesn't write anything, so the key is never created:Run:
Expected behavior
Actual behavior
Other inputs on dsc 3.3.0:
valueData: { DWord: "x" }dsc resource test -r Microsoft.Windows/RegistrymaxValueError details
2026-10-04T10:25:51.959520Z ERROR Schema: Additional properties are not allowed ('valuName' was unexpected)Environment data
Windows 11 Pro for Workstations 25H2, build 26200.
Version
3.3.0 (also reproduced on 3.4.0-preview.1)
Visuals
No response