{"record":{"id":"ce9f9cea24e49dc4","repo":"XTLS/Xray-core","slug":"transform-args-are-required","errorCode":null,"errorMessage":"transform args are required","messagePattern":"transform args are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_finalmask.go","lineNumber":418,"sourceCode":"\tif kindCount > 1 {\n\t\treturn errors.New(\"exactly one item kind must be set\")\n\t}\n\tif kindCount == 0 && capture != \"\" {\n\t\treturn errors.New(\"exactly one item kind must be set\")\n\t}\n\n\treturn nil\n}\n\nfunc buildCustomTransform(transform *CustomTransform) (*custom.Expr, error) {\n\tif transform == nil {\n\t\treturn nil, nil\n\t}\n\tif transform.Op == \"\" {\n\t\treturn nil, errors.New(\"transform op is required\")\n\t}\n\tif len(transform.Args) == 0 {\n\t\treturn nil, errors.New(\"transform args are required\")\n\t}\n\n\targs := make([]*custom.ExprArg, 0, len(transform.Args))\n\tfor _, arg := range transform.Args {\n\t\tparsedArg, err := buildCustomTransformArg(arg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\targs = append(args, parsedArg)\n\t}\n\n\treturn &custom.Expr{\n\t\tOp:   transform.Op,\n\t\tArgs: args,\n\t}, nil\n}\n\nfunc buildCustomTransformArg(arg CustomTransformArg) (*custom.ExprArg, error) {","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_finalmask.go#L400-L436","documentation":"buildCustomTransform (infra/conf/transport_finalmask.go:418) requires a transform to carry at least one argument: \"transform\":{\"op\":\"concat\"} with missing or empty \"args\" returns \"transform args are required\". Args supply the values (bytes/str/u64/reuse/metadata/nested transform) the op operates on.","triggerScenarios":"\"transform\":{\"op\":\"someop\"} with no \"args\" key, or \"args\":[] . Fires on the top-level transform and again on any nested arg.Transform that is non-nil but arg-less.","commonSituations":"Constants-only ops written without arguments; deleting an arg while debugging; nested transform scaffolding left empty after refactoring.","solutions":["Provide at least one entry in \"args\", e.g. [{\"reuse\":\"captured\"}]","Give every nested transform at least one arg too","Drop the transform object if the item needs no computation"],"exampleFix":"// before\n\"transform\": { \"op\": \"concat\" }\n// after\n\"transform\": { \"op\": \"concat\", \"args\": [ {\"str\":\"x\"}, {\"reuse\":\"v\"} ] }","handlingStrategy":"validation","validationCode":"// covered by checkTransform above: args.length === 0 -> throw","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never ship a transform without at least one arg","Validate nested transforms recursively"],"tags":["xray","go","transport","header-custom","transform","validation"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}