{"record":{"id":"7912abf70b1c6bd0","repo":"risingwavelabs/risingwave","slug":"using-must-be-specified","errorCode":null,"errorMessage":"USING must be specified","messagePattern":"USING must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/expr/impl/src/udf/wasm.rs","lineNumber":50,"sourceCode":"    match_fn: |language, _runtime, _link| language == \"wasm\",\n    create_fn: create_wasm,\n    build_fn: build,\n};\n\n#[linkme::distributed_slice(UDF_IMPLS)]\nstatic RUST: UdfImplDescriptor = UdfImplDescriptor {\n    match_fn: |language, _runtime, _link| language == \"rust\",\n    create_fn: create_rust,\n    build_fn: build,\n};\n\nfn create_wasm(opts: CreateOptions<'_>) -> Result<CreateFunctionOutput> {\n    let wasm_binary: Cow<'_, [u8]> = if let Some(link) = opts.using_link {\n        read_file_from_link(link)?.into()\n    } else if let Some(bytes) = opts.using_base64_decoded {\n        bytes.into()\n    } else {\n        bail!(\"USING must be specified\")\n    };\n\n    let runtime = create_wasm_runtime(&wasm_binary)?;\n    if runtime.abi_version().0 <= 2 {\n        bail!(\"legacy arrow-udf is no longer supported. please update arrow-udf to 0.3+\");\n    }\n\n    let name_in_runtime = opts.name.to_owned();\n    let convert = UdfArrowConvert {\n        legacy: runtime_is_legacy(&runtime),\n    };\n    let arg_types: Vec<_> = opts\n        .arg_types\n        .iter()\n        .map(|ty| convert.to_arrow_field(\"\", ty))\n        .try_collect()?;\n    let return_type = convert.to_arrow_field(\"\", opts.return_type)?;\n    match opts.kind {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/impl/src/udf/wasm.rs#L32-L68","documentation":"A WASM UDF must supply its code either via `USING LINK <url>` (fetch wasm binary from a link) or `USING <base64>` (inline binary). `create_wasm` fails when neither option is present, because there is no binary to instantiate a runtime from.","triggerScenarios":"`CREATE FUNCTION ... AS wasm ...` without any USING clause — `CreateOptions` has neither `using_link` nor `using_base64_decoded`.","commonSituations":"Omitting USING when registering a WASM UDF; putting the binary path in the wrong option; mixing up rust-UDF (which uses no USING) with wasm-UDF DDL.","solutions":["Add `USING LINK 'http://.../function.wasm'` to fetch the wasm binary","Or embed the wasm binary as `USING '<base64-encoded wasm>'`","Verify the function is actually a WASM UDF and the DDL template includes a USING clause"],"exampleFix":"-- before\nCREATE FUNCTION f(BIGINT) RETURNS BIGINT AS wasm;\n-- after\nCREATE FUNCTION f(BIGINT) RETURNS BIGINT AS wasm USING LINK 'http://udf:8815/f.wasm';","handlingStrategy":"validation","validationCode":"if (!sql.includes('USING')) throw new Error('wasm UDF registration requires USING LINK or USING <base64>');","typeGuard":null,"tryCatchPattern":"try { await rw.query(createFunctionSql) } catch (e) { if (String(e).includes('USING must be specified')) { /* add USING clause and retry */ } else throw e; }","preventionTips":["Always include USING in wasm UDF DDL templates","Validate DDL templates in CI before deploy","Distinguish rust vs wasm templates clearly"],"tags":["udf","wasm","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}