{"record":{"id":"394c8d289da7d9af","repo":"huggingface/pytorch-image-models","slug":"coefficient-list-cannot-be-empty","errorCode":null,"errorMessage":"Coefficient list cannot be empty","messagePattern":"Coefficient list cannot be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"timm/optim/muon.py","lineNumber":1055,"sourceCode":"\n    if not is_seq(value):\n        raise TypeError(\n            \"Coefficients must be a preset name (str), a 3-sequence (a,b,c), \"\n            \"or a sequence of 3-sequences.\"\n        )\n\n    # Decide single triple vs list-of-triples by structure\n    if len(value) == 3 and all(is_real(v) for v in value):  # type: ignore[index]\n        return [as_coeff(value)]  # single triple -> wrap\n\n    # Otherwise treat as list/tuple of triples\n    out = []\n    for i, item in enumerate(value):  # type: ignore[assignment]\n        if not is_seq(item):\n            raise TypeError(f\"Item {i} is not a sequence: {item!r}\")\n        out.append(as_coeff(item))\n    if not out:\n        raise ValueError(\"Coefficient list cannot be empty\")\n    return out\n","sourceCodeStart":1037,"sourceCodeEnd":1057,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/optim/muon.py#L1037-L1057","documentation":"Thrown by resolve_ns_coefficients in timm's Muon optimizer when the coefficients argument is a sequence of triples but contains zero items. At least one coefficient triple is required.","triggerScenarios":"Passing ns_coefficients=[] to timm.optim.Muon/AdamMuon.","commonSituations":"Programmatically building a per-layer coefficient list that ends up empty (e.g. no layers matched a filter).","solutions":["Ensure the coefficient list has at least one (a,b,c) triple","If dynamically generated, add a fallback default triple when the list would be empty"],"exampleFix":"# before\ncoeffs = []  # built dynamically, ended empty\nMuon(params, ns_coefficients=coeffs)\n\n# after\ncoeffs = coeffs or [(0.9, 0.95, 0.5)]\nMuon(params, ns_coefficients=coeffs)","handlingStrategy":"validation","validationCode":"assert len(ns_coefficients) > 0, 'coefficient list must not be empty'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default dynamically built lists to at least one triple","Log list lengths when building per-layer configs"],"tags":["timm","muon-optimizer","empty-list","valueerror"],"backgroundTag":"invalid-optimizer-argument","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}