{"record":{"id":"3285e086893158bf","repo":"SigNoz/signoz","slug":"errcodeauthdomaininvalidconfig","errorCode":"ErrCodeAuthDomainInvalidConfig","errorMessage":"failed to unmarshal auth domain config","messagePattern":"failed to unmarshal auth domain config","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/types/authtypes/domain_config.go","lineNumber":117,"sourceCode":"\t}\n\n\tmapping := make(map[string]string, len(authDomainConfigVariants))\n\tfor _, variant := range authDomainConfigVariants {\n\t\tmapping[variant.kind.StringValue()] = variant.schemaRef\n\t}\n\n\tschema.ExtraProperties[\"x-signoz-discriminator\"] = map[string]any{\n\t\t\"propertyName\": \"kind\",\n\t\t\"mapping\":      mapping,\n\t}\n\n\treturn nil\n}\n\nfunc (typ *AuthDomainConfig) UnmarshalJSON(data []byte) error {\n\tvar raw map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn errors.Wrapf(err, errors.TypeInvalidInput, ErrCodeAuthDomainInvalidConfig, \"failed to unmarshal auth domain config\")\n\t}\n\n\tkindData, ok := raw[\"kind\"]\n\tif !ok {\n\t\treturn errors.Newf(errors.TypeInvalidInput, ErrCodeAuthDomainInvalidConfig, \"kind is required\")\n\t}\n\n\tvar kind AuthNProvider\n\tif err := json.Unmarshal(kindData, &kind); err != nil {\n\t\treturn errors.Wrapf(err, errors.TypeInvalidInput, ErrCodeAuthDomainInvalidConfig, \"failed to unmarshal kind\")\n\t}\n\n\tspecData, ok := raw[\"spec\"]\n\tif !ok {\n\t\treturn errors.Newf(errors.TypeInvalidInput, ErrCodeAuthDomainInvalidConfig, \"spec is required\")\n\t}\n\n\tfor _, variant := range authDomainConfigVariants {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/authtypes/domain_config.go#L99-L135","documentation":"AuthDomainConfig.UnmarshalJSON first unmarshals the JSON payload into a map[string]json.RawMessage. This error fires when the top-level JSON is malformed or not an object (e.g. an array, bare string, trailing commas), before kind/spec dispatch even happens.","triggerScenarios":"Posting or loading an auth domain config whose body is not valid JSON or not a JSON object, e.g. '[{\"kind\":...}]' or '{\"kind\": \"ldap\",}' with a trailing comma.","commonSituations":"Hand-editing auth domain config files or Helm values with YAML/JSON syntax slips; clients sending the config wrapped in an extra array; secrets templating injecting invalid JSON.","solutions":["Validate the payload with a JSON linter / jq before applying","Ensure the document is a single JSON object with kind and spec keys","If templating, render the template and jq-empty-check the output"],"exampleFix":"// before\nraw := []byte(`[{\"kind\":\"ldap\",\"spec\":{}}]`)\n\n// after\nraw := []byte(`{\"kind\":\"ldap\",\"spec\":{}}`)","handlingStrategy":"validation","validationCode":"import \"encoding/json\"\n\nfunc validDomainConfigJSON(b []byte) bool {\n    var m map[string]json.RawMessage\n    return json.Unmarshal(b, &m) == nil\n}","typeGuard":null,"tryCatchPattern":"var cfg AuthDomainConfig\nif err := json.Unmarshal(body, &cfg); err != nil {\n    return httpError(400, \"auth domain config is not a valid JSON object\")\n}","preventionTips":["Run configs through jq before applying","Use schema validation in config pipelines"],"tags":["json","unmarshal","auth-domain","config"],"backgroundTag":"json-parse-error","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}