{"record":{"id":"7200c3d5bd9a5947","repo":"material-components/material-components-android","slug":"invalid-motion-path-type-pathint-7200c3","errorCode":null,"errorMessage":"Invalid motion path type: > pathInt <","messagePattern":"Invalid motion path type: > pathInt <","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"lib/java/com/google/android/material/transition/platform/TransitionUtils.java","lineNumber":113,"sourceCode":"        return true;\n      }\n    }\n    return false;\n  }\n\n  @Nullable\n  static PathMotion resolveThemePath(Context context, @AttrRes int attrResId) {\n    TypedValue pathValue = new TypedValue();\n    if (context.getTheme().resolveAttribute(attrResId, pathValue, true)) {\n      if (pathValue.type == TypedValue.TYPE_INT_DEC) {\n        int pathInt = pathValue.data;\n        if (pathInt == PATH_TYPE_LINEAR) {\n          // Default Transition PathMotion is linear; no need to override with different PathMotion.\n          return null;\n        } else if (pathInt == PATH_TYPE_ARC) {\n          return new MaterialArcMotion();\n        } else {\n          throw new IllegalArgumentException(\"Invalid motion path type: \" + pathInt);\n        }\n      } else if (pathValue.type == TypedValue.TYPE_STRING) {\n        String pathString = String.valueOf(pathValue.string);\n        return new PatternPathMotion(PathParser.createPathFromPathData(pathString));\n      } else {\n        throw new IllegalArgumentException(\n            \"Motion path theme attribute must either be an enum value or path data string\");\n      }\n    }\n    return null;\n  }\n\n  static ShapeAppearanceModel convertToRelativeCornerSizes(\n      ShapeAppearanceModel shapeAppearanceModel, final RectF bounds) {\n    return shapeAppearanceModel.withTransformedCornerSizes(\n        cornerSize -> RelativeCornerSize.createFromCornerSize(bounds, cornerSize));\n  }\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/material-components/material-components-android/blob/ac7e18efeefb331850c561faf9ab8bf81d27ba68/lib/java/com/google/android/material/transition/platform/TransitionUtils.java#L95-L131","documentation":"TransitionUtils.resolveThemePath reads the theme attribute referenced by a Material transition's motionPath attr. When the resolved TypedValue is an integer (TYPE_INT_DEC) it must be one of the declared enum values: 0 = linear (no PathMotion override) or 1 = arc (MaterialArcMotion). Any other integer — 2, -1, or a plain int that is not part of the enum — throws IllegalArgumentException('Invalid motion path type: ' + pathInt). This guards the enum contract declared in the attr's format.","triggerScenarios":"A theme (often a base theme or overlay) sets the transition's motionPath attribute to a raw integer other than 0/1, e.g. <item name=\"motionPath\">2</item>; a build tool or lint override substitutes the enum with a wrong constant; the attr was redeclared in the app with a different enum set and a stale value leaks in.","commonSituations":"Hand-editing generated theme XML and replacing @enum values with plain ints; themes inherited from a design system where motionPath was redefined; upgrading Material versions where the attr moved and an old literal value (e.g., a leftover 2 from a removed 'through' mode) survives.","solutions":["Set the theme attribute to a valid enum: <item name=\"motionPath\">@enum/linear or the integer 0, or arc/1, or a path-data string like \"M0,0 L100,0\".","Search the whole theme chain (base theme, overlays, themes.xml values-night etc.) for the motionPath item and remove stale literals: grep for the attr name across res/values*.","If you need a custom curve, pass a path string (TYPE_STRING) instead of an out-of-range int.","If inherited from a library theme, override the attribute locally with a valid value in your app theme."],"exampleFix":"<!-- before -->\n<item name=\"motionPath\">2</item>\n\n<!-- after -->\n<item name=\"motionPath\">@enum/linear</item>\n<!-- or a custom curve -->\n<item name=\"motionPath\">M0,0 L100,100</item>","handlingStrategy":"validation","validationCode":"// Verify the theme-supplied value before applying a transition that resolves it.\nTypedValue v = new TypedValue();\nif (context.getTheme().resolveAttribute(R.attr.motionPath, v, true)) {\n  boolean ok = v.type == TypedValue.TYPE_STRING\n      || (v.type == TypedValue.TYPE_INT_DEC && (v.data == 0 || v.data == 1));\n  if (!ok) throw new IllegalStateException(\"Fix motionPath in theme to 0, 1, or path data\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  transition.setPathMotion(TransitionUtils.resolveThemePath(context, attr)); // example\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid motion path type\")) {\n    Log.w(TAG, \"motionPath enum out of range; defaulting to linear\", e);\n    transition.setPathMotion(null); // null PathMotion = linear default\n  } else {\n    throw e;\n  }\n}","preventionTips":["Declare the motionPath attr as format=\"enum|string\" so invalid values fail at build time.","Use enum names (@enum/linear, @enum/arc) rather than raw ints in themes.","Audit merged resources (Material Theme Overlay, values-night) after library upgrades for stale literals."],"tags":["android","material-components","transition","theme","path-motion"],"backgroundTag":null,"analyzedSha":"ac7e18efeefb331850c561faf9ab8bf81d27ba68","analyzedAt":"2026-08-14T15:35:35.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}