{"record":{"id":"5ced56d3ef4cd980","repo":"XTLS/Xray-core","slug":"failed-to-parse-json-config","errorCode":null,"errorMessage":"failed to parse json config","messagePattern":"failed to parse json config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/serial/loader.go","lineNumber":100,"sourceCode":"\tif err != nil {\n\t\treturn nil, errors.New(\"failed to read config file\").Base(err)\n\t}\n\tjsonConfig := &conf.Config{}\n\tif err := json.Unmarshal(data, jsonConfig); err != nil {\n\t\treturn nil, errors.New(\"failed to parse remote JSON config\").Base(err)\n\t}\n\treturn jsonConfig, nil\n}\n\nfunc LoadJSONConfig(reader io.Reader) (*core.Config, error) {\n\tjsonConfig, err := DecodeJSONConfig(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpbConfig, err := jsonConfig.Build()\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to parse json config\").Base(err)\n\t}\n\n\treturn pbConfig, nil\n}\n\n// DecodeTOMLConfig reads from reader and decode the config into *conf.Config\n// using github.com/pelletier/go-toml and map to convert toml to json.\nfunc DecodeTOMLConfig(reader io.Reader) (*conf.Config, error) {\n\ttomlFile, err := io.ReadAll(reader)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to read config file\").Base(err)\n\t}\n\n\tconfigMap := make(map[string]interface{})\n\tif err := toml.Unmarshal(tomlFile, &configMap); err != nil {\n\t\treturn nil, errors.New(\"failed to convert toml to map\").Base(err)\n\t}\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/serial/loader.go#L82-L118","documentation":"Error \"failed to parse json config\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at infra/conf/serial/loader.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}