{"record":{"id":"58ac62176d2169d2","repo":"hashicorp/terraform","slug":"retrieving-s-model-was-nil","errorCode":null,"errorMessage":"retrieving %s: model was nil","messagePattern":"retrieving (.+?): model was nil","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote-state/azure/api_client.go","lineNumber":109,"sourceCode":"\t\tif config.SubscriptionID == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"subscription id not specified\")\n\t\t}\n\n\t\t// Setup the SA client.\n\t\tclient.storageAccountsClient, err = storageaccounts.NewStorageAccountsClientWithBaseURI(config.AuthConfig.Environment.ResourceManager)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"building Storage Accounts client: %+v\", err)\n\t\t}\n\t\tclient.configureClient(client.storageAccountsClient.Client, resourceManagerAuth)\n\n\t\t// Populating the storage account detail\n\t\tstorageAccountId := commonids.NewStorageAccountID(config.SubscriptionID, config.ResourceGroupName, client.storageAccountName)\n\t\tresp, err := client.storageAccountsClient.GetProperties(ctx, storageAccountId, storageaccounts.DefaultGetPropertiesOperationOptions())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"retrieving %s: %+v\", storageAccountId, err)\n\t\t}\n\t\tif resp.Model == nil {\n\t\t\treturn nil, fmt.Errorf(\"retrieving %s: model was nil\", storageAccountId)\n\t\t}\n\t\tclient.accountDetail, err = populateAccountDetails(storageAccountId, *resp.Model)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"populating details for %s: %+v\", storageAccountId, err)\n\t\t}\n\t}\n\n\treturn &client, nil\n}\n\nfunc (c *Client) getBlobClient(ctx context.Context) (bc *blobs.Client, err error) {\n\tif c.blobsClient != nil {\n\t\treturn c.blobsClient, nil\n\t}\n\n\tdefer func() {\n\t\tif err == nil {\n\t\t\tc.blobsClient = bc","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/azure/api_client.go#L91-L127","documentation":"Returned by buildClient when storageAccountsClient.GetProperties returns no error but the response Model is nil. The ARM API returned a successful-looking response with no storage account payload, which is unexpected. The %s is the storage account resource ID.","triggerScenarios":"The ARM GetProperties call completes without an HTTP/transport error but the deserialized storage account model is nil — an edge case in the API/SDK where a 2xx or empty body yields no model. Very rare; indicates an SDK/API contract issue or an unexpected empty response.","commonSituations":"An Azure API/SDK version quirk returning an empty body for a valid account; proxy or gateway stripping the response body; an SDK deserialization mismatch after a backend API change.","solutions":["Retry the operation (can be a transient API anomaly).","Update/upgrade Terraform (and thus the go-azure-sdk storage version) which may handle the response shape correctly.","Report the issue with the storage account resource ID if it persists — likely an SDK/API contract bug."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"client, err := buildClient(ctx, config)\nif err != nil && strings.Contains(err.Error(), \"model was nil\") {\n    // retry once; if it persists, report SDK/API version issue\n}","preventionTips":["Retry on first occurrence — nil-model is often a transient API anomaly.","Keep Terraform updated so the embedded go-azure-sdk matches the current ARM contract.","Report persistent nil-model responses with the resource ID to the SDK maintainers."],"tags":["azure","backend","resource-manager","storage-account","sdk","terraform"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}