{"record":{"id":"3203ce6e626abc6e","repo":"apache/beam","slug":"javascript-mapping-functions-are-not-supported-because-the","errorCode":null,"errorMessage":"Javascript mapping functions are not supported because the quickjs-ng library is not installed.","messagePattern":"Javascript mapping functions are not supported because the quickjs-ng library is not installed\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_mapping.py","lineNumber":256,"sourceCode":"  elif isinstance(py_value, bytes):\n    return py_value.decode('utf-8', errors='replace')\n  elif isinstance(py_value, (datetime.datetime, datetime.date, datetime.time)):\n    return {'__date__': True, 'value': py_value.isoformat()}\n  elif isinstance(py_value, Decimal):\n    return float(py_value)\n  elif not isinstance(py_value, str) and isinstance(py_value, abc.Iterable):\n    return [py_value_to_js_dict(value) for value in list(py_value)]\n  else:\n    return py_value\n\n\n# TODO(yaml) Consider adding optional language version parameter to support\n#  ECMAScript 5 and 6\ndef _expand_javascript_mapping_func(\n    original_fields, expression=None, callable=None, path=None, name=None):\n\n  if quickjs is None:\n    raise ValueError(\n        \"Javascript mapping functions are not supported because the \"\n        \"quickjs-ng library is not installed.\")\n\n  if expression:\n    source_code = f\"\"\"\n    function udf(__row__) {{\n      with (__row__) {{\n        return ({expression});\n      }}\n    }}\n    \"\"\"\n    user_entrypoint = 'udf'\n\n  elif callable:\n    source_code = f\"var __udf__ = ({callable});\"\n    user_entrypoint = '__udf__'\n\n  else:","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_mapping.py#L238-L274","documentation":"JavaScript mapping transforms in Beam YAML require the quickjs-ng runtime. This ValueError fires when the quickjs import resolved to None (library not installed), so no JS evaluation engine is available.","triggerScenarios":"Using a mapping transform with language javascript (or path/name-based JS UDF) when the quickjs-ng Python package is absent from the environment; detected in _expand_javascript_mapping_func when `quickjs is None`.","commonSituations":"Minimal/production installs that omitted the extras (e.g. missing apache-beam[yaml] extras); running in environments without the wheel for your platform; upgrades where an optional dependency was dropped.","solutions":["Install the dependency: pip install quickjs-ng (or apache-beam with the appropriate extras).","Recreate the environment ensuring optional extras are included.","If quickjs cannot be installed, switch the mapping to language python or jinja.","Verify installation with: python -c \"import quickjs\"."],"exampleFix":"# before: pipeline fails, no JS support\n# after: install then run\npip install quickjs-ng\n# or switch config:\n# language: javascript  ->  language: python\n# expression: \"row.x + 1\"","handlingStrategy":"fallback","validationCode":"try:\n    import quickjs\n    HAVE_JS = True\nexcept ImportError:\n    HAVE_JS = False\nif using_js and not HAVE_JS: raise EnvironmentError('pip install quickjs-ng')","typeGuard":null,"tryCatchPattern":"try:\n    pipeline = build(js_config)\nexcept ValueError as e:\n    if 'quickjs-ng' in str(e):\n        install('quickjs-ng') or switch to language python\n    else:\n        raise","preventionTips":["Install apache-beam with the yaml extras or quickjs-ng explicitly","Pin and export requirements so CI and prod match","Check `python -c \"import quickjs\"` in environment smoke tests","Prefer python/jinja mappings when JS support is unavailable"],"tags":["javascript","dependency","beam-yaml"],"backgroundTag":"missing-optional-dependency","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}