{"record":{"id":"944634ef00646f67","repo":"gofr-dev/gofr","slug":"invalid-azure-configuration-account-name-is-requi","errorCode":null,"errorMessage":"invalid Azure configuration: account name is required","messagePattern":"invalid Azure configuration: account name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gofr/datasource/file/azure/fs.go","lineNumber":13,"sourceCode":"package azure\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"time\"\n\n\t\"gofr.dev/pkg/gofr/datasource/file\"\n)\n\nvar (\n\terrInvalidConfig       = errors.New(\"invalid Azure configuration: share name is required\")\n\terrAccountNameRequired = errors.New(\"invalid Azure configuration: account name is required\")\n\terrAccountKeyRequired  = errors.New(\"invalid Azure configuration: account key is required\")\n)\n\nconst defaultTimeout = 10 * time.Second\n\ntype azureFileSystem struct {\n\t*file.CommonFileSystem\n}\n\n// Config represents the Azure File Storage configuration.\ntype Config struct {\n\tAccountName string // Azure Storage Account name\n\tAccountKey  string // Azure Storage Account key\n\tShareName   string // Azure File Share name\n\tEndpoint    string // Azure Storage endpoint (optional, defaults to core.windows.net)\n}\n\n// New creates and validates a new Azure File Storage file system.","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/gofr-dev/gofr/blob/187eb24962502e91f1fee856230670958b66e89c/pkg/gofr/datasource/file/azure/fs.go#L1-L31","documentation":"During azure.New, validation checks that Config.AccountName is non-empty and returns the sentinel errAccountNameRequired — \"invalid Azure configuration: account name is required\" — if it is blank. The account name identifies the storage account hosting the file share and is required to build the azfile service client, so the library refuses to construct the filesystem without it.","triggerScenarios":"Calling azure.New with a Config whose AccountName == \"\": the env var for the storage account unset, a typo in the config key, or building the struct with only AccountKey and ShareName set.","commonSituations":"Deploying to an environment where AZURE_STORAGE_ACCOUNT_NAME was never injected; renaming config keys during refactor; multi-environment setups where staging config omits the account name; secrets manager returning empty values.","solutions":["Set Config.AccountName to the Azure storage account name before calling azure.New.","Verify the environment variable/secret feeding the account name resolves in the target environment.","Check for typos between config struct keys and the source (yaml/env/json) keys.","Log-or-assert non-empty account name at application startup for fail-fast behavior."],"exampleFix":"// before\ncfg := &Config{ShareName: \"files\", AccountKey: key} // AccountName missing\nfs := azure.New(cfg)\n// after\ncfg := &Config{ShareName: \"files\", AccountName: os.Getenv(\"AZURE_ACCOUNT_NAME\"), AccountKey: key}\nfs := azure.New(cfg)","handlingStrategy":"validation","validationCode":"if cfg.AccountName == \"\" {\n    return errors.New(\"AZURE_ACCOUNT_NAME is required for azure files\")\n}","typeGuard":"func hasAccountName(cfg *azure.Config) bool {\n    return cfg != nil && strings.TrimSpace(cfg.AccountName) != \"\"\n}","tryCatchPattern":null,"preventionTips":["Inject the storage account name via a well-documented env var and assert it at boot.","Keep staging and production config templates in sync.","Check for whitespace-only values, not just empty strings."],"tags":["azure","configuration","azure-files","missing-config"],"backgroundTag":"missing-config-field","analyzedSha":"187eb24962502e91f1fee856230670958b66e89c","analyzedAt":"2026-09-01T20:34:54.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}