{"record":{"id":"e2686e8cdf667579","repo":"Comfy-Org/ComfyUI","slug":"unknown-rope-img-rope-img","errorCode":null,"errorMessage":"Unknown rope_img: {rope_img}","messagePattern":"Unknown rope_img: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/hydit/posemb_layers.py","lineNumber":205,"sourceCode":"        freqs_sin = freqs.sin().repeat_interleave(2, dim=1)  # [S, D]\n        return freqs_cos, freqs_sin\n    else:\n        freqs_cis = torch.polar(torch.ones_like(freqs), freqs)  # complex64     # [S, D/2]\n        return freqs_cis\n\n\n\ndef calc_sizes(rope_img, patch_size, th, tw):\n    if rope_img == 'extend':\n        # Expansion mode\n        sub_args = [(th, tw)]\n    elif rope_img.startswith('base'):\n        # Based on the specified dimensions, other dimensions are obtained through interpolation.\n        base_size = int(rope_img[4:]) // 8 // patch_size\n        start, stop = get_fill_resize_and_crop((th, tw), base_size)\n        sub_args = [start, stop, (th, tw)]\n    else:\n        raise ValueError(f\"Unknown rope_img: {rope_img}\")\n    return sub_args\n\n\ndef init_image_posemb(rope_img,\n                      resolutions,\n                      patch_size,\n                      hidden_size,\n                      num_heads,\n                      log_fn,\n                      rope_real=True,\n                      ):\n    freqs_cis_img = {}\n    for reso in resolutions:\n        th, tw = reso.height // 8 // patch_size, reso.width // 8 // patch_size\n        sub_args = calc_sizes(rope_img, patch_size, th, tw)\n        freqs_cis_img[str(reso)] = get_2d_rotary_pos_embed(hidden_size // num_heads, *sub_args, use_real=rope_real)\n        log_fn(f\"    Using image RoPE ({rope_img}) ({'real' if rope_real else 'complex'}): {sub_args} | ({reso}) \"\n               f\"{freqs_cis_img[str(reso)][0].shape if rope_real else freqs_cis_img[str(reso)].shape}\")","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/hydit/posemb_layers.py#L187-L223","documentation":"calc_sizes accepts only two rope_img modes: 'extend' (plain grid over (th, tw)) and 'baseXXX' (interpolate relative to a base resolution, where XXX is the pixel size divided by 8*patch_size). Any other string is rejected because there is no defined way to build the position grid.","triggerScenarios":"Calling init_image_posemb/calc_sizes with rope_img values like 'xy', 'base', '1024', or a typo such as 'extenda'; the 'base' branch requires trailing digits (e.g. 'base512').","commonSituations":"Ported config keys from other DiT implementations (Flux/Wan use different rope names), typos, or checkpoint configs with unsupported bucketing strategies.","solutions":["Use 'extend' for plain grids, or 'base' + integer size like 'base1024' for the interpolated mode","Check the model's config file for the exact rope_img string the checkpoint was trained with","If you need a new mode, add an explicit branch rather than passing an unknown string"],"exampleFix":"# before\nrope_img = \"1024\"  # ValueError\n# after\nrope_img = \"base1024\"","handlingStrategy":"validation","validationCode":"assert rope_img == 'extend' or (rope_img.startswith('base') and rope_img[4:].isdigit()), rope_img","typeGuard":"def is_valid_rope_img(v: str) -> bool:\n    return v == 'extend' or (v.startswith('base') and v[4:].isdigit())","tryCatchPattern":null,"preventionTips":["Keep rope_img as an enum of two shapes in config tooling","Validate config strings at load, not at forward"],"tags":["hydit","rope","config","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}