{"record":{"id":"4cd4233e81b7f856","repo":"material-components/material-components-android","slug":"invalid-motion-path-type-pathint","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/TransitionUtils.java","lineNumber":108,"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":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/material-components/material-components-android/blob/ac7e18efeefb331850c561faf9ab8bf81d27ba68/lib/java/com/google/android/material/transition/TransitionUtils.java#L90-L126","documentation":"TransitionUtils.resolveThemePath (TransitionUtils.java:108) reads a motion-path theme attribute (e.g. motionPath) for container transforms. When the attribute resolves to an integer enum it must be PATH_TYPE_LINEAR (0) or PATH_TYPE_ARC (1); any other int throws IllegalArgumentException with the offending value. The int is meant to come from an <enum> declared in attrs, so an out-of-range value means malformed theme XML or an int injected programmatically via a theme overlay.","triggerScenarios":"A theme/overlay defining the motion-path attr with an int other than 0 or 1 (e.g. android:value=\"2\" or an out-of-sync enum constant); reusing a stale R.attr value after library update changed the enum space; programmatic themes (MaterialThemeDrawable/theme overlay XML) with a hand-written integer.","commonSituations":"Hand-editing enum values in a theme; library version mismatch where an app module compiled against different constants than the resolved material library; copy-pasting a motionPath attr config from an incompatible fork.","solutions":["In the theme, use only the declared enum values for the motion path attribute (linear or arc).","If a path shape is needed, supply path-data string syntax instead of an int (e.g. a path string like \"M0,0 L100,100\"), which takes the TYPE_STRING branch.","Sync material library versions across modules so enum constants match at runtime."],"exampleFix":"<!-- before -->\n<style name=\"AppTheme\" parent=\"...\">\n  <item name=\"motionPath\">2</item> <!-- invalid enum int -->\n</style>\n\n<!-- after -->\n<style name=\"AppTheme\" parent=\"...\">\n  <item name=\"motionPath\">arc</item> <!-- or omit for default linear -->\n</style>","handlingStrategy":"validation","validationCode":"// theme values can't be intercepted in Java; validate the XML at build time instead\n// e.g. a unit test parsing styles for the motionPath item:\n// assert value is one of {linear enum(0), arc enum(1)} or a path-data string\nstatic boolean isValidMotionPathValue(TypedValue v) {\n  if (v.type == TypedValue.TYPE_INT_DEC) return v.data == 0 || v.data == 1;\n  return v.type == TypedValue.TYPE_STRING;\n}","typeGuard":null,"tryCatchPattern":"try { resolveThemePath(context, attr); } catch (IllegalArgumentException e) { /* fall back to default linear path */ return null; } // appropriate since linear is a safe default","preventionTips":["Use only the declared enum values or path-data strings for motion-path theme attrs.","Keep material library versions aligned across Gradle modules.","Add a CI XML lint rule for the motionPath attr."],"tags":["android","material-components","theme","motion-path","transition","enum-validation"],"backgroundTag":null,"analyzedSha":"ac7e18efeefb331850c561faf9ab8bf81d27ba68","analyzedAt":"2026-08-14T15:35:35.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}