{"record":{"id":"81750ff75592f4d0","repo":"hasura/graphql-engine","slug":"setup-global-config-object-w","errorCode":null,"errorMessage":"setup global config object: %w","messagePattern":"setup global config object: %w","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"cli/global_config.go","lineNumber":155,"sourceCode":"\t\tec.GlobalConfigFile = filepath.Join(ec.GlobalConfigDir, GlobalConfigFileName)\n\t\tec.Logger.Debugf(\"global config file set as '%s'\", ec.GlobalConfigFile)\n\t}\n\n\t// check if the global config file exist\n\t_, err = os.Stat(ec.GlobalConfigFile)\n\tif stderrors.Is(err, fs.ErrNotExist) {\n\t\t// file does not exist, teat as first run and create it\n\t\tec.Logger.Debug(\n\t\t\t\"global config file does not exist, this could be the first run, creating it...\",\n\t\t)\n\n\t\t// create an empty config object\n\t\tgc := &rawGlobalConfig{}\n\n\t\t// populate the keys\n\t\terr := gc.validateKeys()\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"setup global config object: %w\", err))\n\t\t}\n\n\t\t// write the file\n\t\terr = gc.write(ec.GlobalConfigFile)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"write global config file: %w\", err))\n\t\t}\n\n\t\tec.Logger.Debugf(\n\t\t\t\"global config file written at '%s' with content '%v'\",\n\t\t\tec.GlobalConfigFile,\n\t\t\tgc,\n\t\t)\n\n\t\t// also show a notice about telemetry\n\t\tec.Logger.Info(TelemetryNotice)\n\t} else if stderrors.Is(err, fs.ErrExist) || err == nil {\n\t\t// file exists, verify contents","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/global_config.go#L137-L173","documentation":"While creating a brand-new global config file, validateKeys() on the freshly constructed empty rawGlobalConfig returned an error. This indicates the in-code set of expected/allowed keys is internally inconsistent (e.g. defaults defined for keys that are not in the known-keys list) rather than any user input problem — the object is empty at this point.","triggerScenarios":"A version of the CLI where a new config key was added to rawGlobalConfig/defaults but not registered in the known keys map, so validateKeys rejects the empty object on first-run initialization.","commonSituations":"Upgrading to a release with a key-validation regression, running a dev build mid-refactor, or a fork where keys were edited without updating the validation list.","solutions":["Upgrade or pin to a CLI version without the key-validation mismatch (this is effectively an internal bug)","If building from source, ensure every key with a default appears in the allowed-keys set used by validateKeys","Report the issue upstream with the CLI version","As a workaround, pre-create a valid config file so the code takes the read path instead of the create path"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := ec.Prepare(ctx); err != nil {\n    if strings.Contains(err.Error(), \"setup global config object\") {\n        // internal key-validation bug: pin a known-good CLI version\n        log.Fatal(\"known bug in this CLI version; upgrade the CLI\")\n    }\n    return err\n}","preventionTips":["Pin CLI versions in CI and Dockerfiles to avoid untested releases","Report the mismatch upstream — validateKeys on an empty object should not fail"],"tags":["go","config","internal-error","version-mismatch"],"backgroundTag":"config-schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}