{"record":{"id":"73c7014a4bff1428","repo":"XTLS/Xray-core","slug":"failed-to-convert-toml-to-map","errorCode":null,"errorMessage":"failed to convert toml to map","messagePattern":"failed to convert toml to map","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/serial/loader.go","lineNumber":116,"sourceCode":"\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\n\tjsonFile, err := json.Marshal(&configMap)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to convert map to json\").Base(err)\n\t}\n\n\treturn DecodeJSONConfig(bytes.NewReader(jsonFile))\n}\n\nfunc LoadTOMLConfig(reader io.Reader) (*core.Config, error) {\n\ttomlConfig, err := DecodeTOMLConfig(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpbConfig, err := tomlConfig.Build()\n\tif err != nil {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/serial/loader.go#L98-L134","documentation":"Error \"failed to convert toml to map\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at infra/conf/serial/loader.go:116 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-15T22:17:37.221Z"}