Azure / Azure/bicep

Decompile fails with "Value cannot be null. (Parameter 'value')" when nested template parameter doesn't have a "value"

Open
#9,856 0 comments 0 reactions 0 assignees View on GitHub
bug story: decompiler
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

```jsonc
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"lookup_Topology": {
"type": "string",
"metadata": {
"description": "description"
},
"defaultValue": ""
}
},
"functions": [],
"variables": {
"deploymentApiVersion": "deploymentApiVersion"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"name": "Topology",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[parameters('lookup_Topology')]",
"contentVersion": "1.0.0.0"

},
"parameters": {
"cloudInstance": {
"value": "abc"

},
"stamp": {
"type": "def" // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

},
"environment": {
"value": "env"

}

}

}
}

],
"outputs": {}
}
```
```
4:56:02 PM: Decompiling c:\Users\stephwe\Repos\abc\bug2.json into Bicep...
Decompilation failed. Please fix the following problems and try again: Value cannot be null. (Parameter 'value')
```

You can also repro with Paste as Bicep by pasting the following shorter text:
```json
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('deploymentApiVersion')]",
"name": "Topology",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[parameters('lookup_Topology')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"cloudInstance": {
"value": "[reference('Common').outputs.cloudInstance.value]"
},
"stamp": {
"type": "[variables('stamp')]"
},
"environment": {
"value": "[variables('environment')]"
}
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Use the supplied full template and the shorter Paste as Bicep JSON as reproducible cases. Start by running both through decompilation and trace the handling of nested deployment parameters; done means neither input produces the null-value failure and both decompile successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.