{"data":{"id":"magento2-40459","source":"github-pr","sourceRef":"magento/magento2#40459","title":"REST API Attribute Update fails without attribute_id","pr":{"number":40459,"url":"https://github.com/magento/magento2/pull/40459","author":"cmuench","mergedAt":"2026-06-25T11:59:10Z","mergeCommit":"f60e189088e14b685c58075381f8449c5414b8f3","headCommit":"a0348c6fb44ab48b73ec27daa8c76a4dfb19a260","baseRef":"2.4-develop","diffSha256":"00264a8a02f246956463f5c907f681e56aab1935918c9dcb59aa7cc5940f1a27"},"issues":[{"number":40458,"url":"https://github.com/magento/magento2/issues/40458","title":"REST API Attribute Update fails without attribute_id","labels":["Area: APIs","Component: Api","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: done","Reported on 2.4.8-p3","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":null,"containingTags":[],"reportedOn":"2.4.8-p3","codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"clean"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10","2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"components":["magento/module-catalog"],"files":[{"path":"app/code/Magento/Catalog/Model/Product/Attribute/Repository.php","change":"modified","package":"magento/module-catalog"}],"stripped":{"tests":["app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php"],"docs":[],"outsideCode":[]},"linesChanged":25,"mergeBatched":false,"excluded":null,"sections":{"description":"Response 400 Bad Request:","stepsToReproduce":"**Update without attribute_id**\n1. Send a `PUT` request to `/V1/products/attributes/{attributeCode}`.\n2. In the payload, include `attribute_code` but omit `attribute_id`.\n\nCan be tested e.g. with the \"color\" attribute.","expectedResult":"The API should recognize the existing attribute by `attribute_code` from the URL and perform an update.","actualResult":"Response 400 Bad Request:\n\n```json\n{\n  \"message\": \"%1 already exists.\",\n  \"parameters\": [\n    \"Attribute with the same code\"\n  ]\n}\n```","source":"issue"},"signatures":[],"labels":{"area":["APIs"],"component":["Api"],"priority":"P2","severity":null,"reportedOn":["2.4.8-p3"]},"categories":["Web API"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"c7bc3ca8a905b73b359affe83e2d8a509b6c2db47e44fb580b9089a3f0a15739","isBugfix":0.9784,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9587,"feature":0.0101,"refactor":0.0133,"tests_only":0.0086,"docs_only":0.0043,"dependency":0.005},"confidence":0.9034},"scope":{"score":1.2453,"probabilities":{"0":0.1526,"1":0.4496,"2":0.3978},"confidence":0.0756},"risk":{"score":0.4196,"probabilities":{"0":0.6407,"1":0.2991,"2":0.0602},"confidence":0.2553},"area":{"choice":"catalog","probabilities":{"catalog":0.643,"checkout":0.0039,"customer":0.0035,"admin":0.018,"graphql_api":0.311,"framework":0.0085,"frontend":0.0039,"other":0.0082},"confidence":0.4407},"securityRelevant":0.0065,"reportedVersion":{"choice":"2.4.8-p3","probabilities":{"2.4.0":0.0023,"2.4.0-p1":0.0024,"2.4.1":0.0024,"2.4.1-p1":0.0024,"2.4.2":0.0023,"2.4.2-p1":0.0024,"2.4.2-p2":0.0025,"2.4.3":0.0027,"2.4.3-p1":0.003,"2.4.3-p2":0.003,"2.4.3-p3":0.0031,"2.4.4":0.0027,"2.4.4-p1":0.0025,"2.4.4-p10":0.0031,"2.4.4-p11":0.0034,"2.4.4-p12":0.0032,"2.4.4-p13":0.0041,"2.4.4-p14":0.0038,"2.4.4-p15":0.0032,"2.4.4-p16":0.0033,"2.4.4-p17":0.0039,"2.4.4-p18":0.0031,"2.4.4-p2":0.0022,"2.4.4-p3":0.0023,"2.4.4-p4":0.0024,"2.4.4-p5":0.0024,"2.4.4-p6":0.0028,"2.4.4-p7":0.0026,"2.4.4-p8":0.0031,"2.4.4-p9":0.0026,"2.4.5":0.0026,"2.4.5-p1":0.0025,"2.4.5-p10":0.0026,"2.4.5-p11":0.003,"2.4.5-p12":0.0036,"2.4.5-p13":0.0034,"2.4.5-p14":0.0034,"2.4.5-p15":0.0031,"2.4.5-p16":0.0029,"2.4.5-p17":0.0027,"2.4.5-p2":0.0028,"2.4.5-p3":0.0029,"2.4.5-p4":0.0028,"2.4.5-p5":0.003,"2.4.5-p6":0.0032,"2.4.5-p7":0.0032,"2.4.5-p8":0.0033,"2.4.5-p9":0.0024,"2.4.6":0.0036,"2.4.6-p1":0.0031,"2.4.6-p10":0.004,"2.4.6-p11":0.0049,"2.4.6-p12":0.0057,"2.4.6-p13":0.005,"2.4.6-p14":0.0041,"2.4.6-p15":0.004,"2.4.6-p2":0.003,"2.4.6-p3":0.0034,"2.4.6-p4":0.0045,"2.4.6-p5":0.0042,"2.4.6-p6":0.0051,"2.4.6-p7":0.0044,"2.4.6-p8":0.0047,"2.4.6-p9":0.0029,"2.4.7":0.0051,"2.4.7-p1":0.0052,"2.4.7-p10":0.0055,"2.4.7-p2":0.0039,"2.4.7-p3":0.0058,"2.4.7-p4":0.0079,"2.4.7-p5":0.0043,"2.4.7-p6":0.0068,"2.4.7-p7":0.0049,"2.4.7-p8":0.0053,"2.4.7-p9":0.0029,"2.4.8":0.0481,"2.4.8-p1":0.0041,"2.4.8-p2":0.0126,"2.4.8-p3":0.6294,"2.4.8-p4":0.017,"2.4.8-p5":0.0139,"2.4.9":0.0078,"unspecified":0.0043},"confidence":0.393},"backportWorthy":{"score":1.5889,"probabilities":{"0":0.0797,"1":0.2517,"2":0.6686},"confidence":0.2751}},"curated":{"title":"Fixes the REST attribute update failing without attribute_id","description":"PUT /V1/products/attributes/:code without attribute_id in the payload attempted to create a new attribute, resulting in a duplicate code error. Numeric option IDs missing from the database also caused a SQL Integrity Constraint Violation. The fix resolves attribute_id from the attribute code and treats invalid option IDs as new options.","categories":["Web API"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:20:17.918Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:17.918Z"}}},"2.4.9":{"before":"pass","after":"error","adapted":false,"runAt":"2026-10-06T09:20:19.500Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"pass","after":"error","runAt":"2026-10-06T09:20:19.500Z"}}},"2.4.7-p10":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:29:30.220Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:29:30.220Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40459 details"}