{"record":{"id":"a26962feb9b528a9","repo":"sgl-project/sglang","slug":"mask-search-files-path-pos-mask-search-files-path","errorCode":null,"errorMessage":"mask_search_files_path_pos, mask_search_files_path_neg, and save_dir are required for STA_tuning_cfg mode","messagePattern":"mask_search_files_path_pos, mask_search_files_path_neg, and save_dir are required for STA_tuning_cfg mode","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/attention/STA_configuration.py","lineNumber":164,"sourceCode":"        )\n\n        return mask_strategy_3d\n    elif mode == \"STA_tuning_cfg\":\n        # Get required parameters for both positive and negative paths\n        mask_search_files_path_pos: str | None = kwargs.get(\n            \"mask_search_files_path_pos\"\n        )\n        mask_search_files_path_neg: str | None = kwargs.get(\n            \"mask_search_files_path_neg\"\n        )\n        save_dir_cfg: str | None = kwargs.get(\"save_dir\")\n\n        if (\n            not mask_search_files_path_pos\n            or not mask_search_files_path_neg\n            or not save_dir_cfg\n        ):\n            raise ValueError(\n                \"mask_search_files_path_pos, mask_search_files_path_neg, and save_dir are required for STA_tuning_cfg mode\"\n            )\n\n        # Get optional parameters with defaults\n        mask_candidates_cfg: list[str] | None = kwargs.get(\"mask_candidates\")\n        if mask_candidates_cfg is None:\n            raise ValueError(\"mask_candidates is required for STA_tuning_cfg mode\")\n        mask_selected_cfg: list[int] = kwargs.get(\n            \"mask_selected\", list(range(len(mask_candidates_cfg)))\n        )\n        skip_time_steps_cfg: int | None = kwargs.get(\"skip_time_steps\")\n\n        # Parse selected masks\n        selected_masks_cfg: list[list[int]] = []\n        for index in mask_selected_cfg:\n            mask = mask_candidates_cfg[index]\n            masks_list = [int(x) for x in mask.split(\",\")]\n            selected_masks_cfg.append(masks_list)","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/attention/STA_configuration.py#L146-L182","documentation":"configure_sta in STA_tuning_cfg mode requires three kwargs: mask_search_files_path_pos, mask_search_files_path_neg, and save_dir. The check uses truthiness, so None, empty string, or a missing key all trigger it. These paths point to positive/negative mask-search result JSON directories and where the tuned mask strategy will be written.","triggerScenarios":"Calling configure_sta(mode='STA_tuning_cfg') (via prepare_sta_param) without passing mask_search_files_path_pos, mask_search_files_path_neg, or save_dir in kwargs, or passing any of them as '' or None.","commonSituations":"Running sparse-tuning-attention (STA) config generation where the caller copied an example that omitted the pos/neg search directories, or typos in kwarg names (e.g. mask_search_files_path instead of ..._pos/_neg), or an empty save_dir from an unset CLI arg.","solutions":["Pass all three kwargs: mask_search_files_path_pos='<dir of pos JSON results>', mask_search_files_path_neg='<dir of neg JSON results>', save_dir='<output dir>'","Check for typos/whitespace in the kwarg names and ensure none resolve to empty strings from CLI/env defaults","Verify the pos/neg directories actually exist and contain the search-result JSON files before running"],"exampleFix":"# before\nconfigure_sta(mode=\"STA_tuning_cfg\", mask_search_files_path_pos=pos_dir)\n# after\nconfigure_sta(\n    mode=\"STA_tuning_cfg\",\n    mask_search_files_path_pos=pos_dir,\n    mask_search_files_path_neg=neg_dir,\n    save_dir=out_dir,\n)","handlingStrategy":"validation","validationCode":"required = [\"mask_search_files_path_pos\", \"mask_search_files_path_neg\", \"save_dir\"]\nmissing = [k for k in required if not kwargs.get(k)]\nassert not missing, f\"missing STA_tuning_cfg kwargs: {missing}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize STA kwargs construction in one helper that asserts required keys per mode","Fail fast in CLI parsing when save_dir is an empty string"],"tags":["sta","attention","sparse-tuning","kwargs-validation","multimodal"],"backgroundTag":"missing-required-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}