{"record":{"id":"78a82cdd190478c4","repo":"XTLS/Xray-core","slug":"unable-to-load-config","errorCode":null,"errorMessage":"Unable to load config","messagePattern":"Unable to load config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/config.go","lineNumber":159,"sourceCode":"\t\tif hasProtobuf {\n\t\t\tif len(v) == 1 {\n\t\t\t\treturn configLoaderByName[\"protobuf\"].Loader(v)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"Only one protobuf config file is allowed\").AtWarning()\n\t\t\t}\n\t\t}\n\n\t\t// to avoid import cycle\n\t\treturn ConfigBuilderForFiles(files)\n\tcase io.Reader:\n\t\tif f, found := configLoaderByName[formatName]; found {\n\t\t\treturn f.Loader(v)\n\t\t} else {\n\t\t\treturn nil, errors.New(\"Unable to load config in\", formatName).AtWarning()\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"Unable to load config\").AtWarning()\n}\n\nfunc loadProtobufConfig(data []byte) (*Config, error) {\n\tconfig := new(Config)\n\tif err := proto.Unmarshal(data, config); err != nil {\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}\n\nfunc init() {\n\tcommon.Must(RegisterConfigLoader(&ConfigFormat{\n\t\tName:      \"Protobuf\",\n\t\tExtension: []string{\"pb\"},\n\t\tLoader: func(input interface{}) (*Config, error) {\n\t\t\tswitch v := input.(type) {\n\t\t\tcase cmdarg.Arg:\n\t\t\t\tr, err := confloader.LoadConfig(v[0])","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/core/config.go#L141-L177","documentation":"Catch-all in LoadConfig when the input is neither cmdarg.Arg nor io.Reader — an unsupported input type was passed to the config loading entry point. Indicates a programming error in the caller rather than a user config problem. Logged at Warning.","triggerScenarios":"Thrown at core/config.go:159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a file list (cmdarg.Arg), an io.Reader, or a supported input type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","contentChangedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}