{"record":{"id":"e55573ed0a9e6d4b","repo":"didi/DoKit","slug":"priority-already-set","errorCode":null,"errorMessage":"Priority already set.","messagePattern":"Priority already set\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java","lineNumber":414,"sourceCode":"      rotationPivotX = 0;\n      rotationPivotY = 0;\n      hasRotationPivot = false;\n      return this;\n    }\n\n    /** Decode the image using the specified config. */\n    public Builder config(Bitmap.Config config) {\n      this.config = config;\n      return this;\n    }\n\n    /** Execute request using the specified priority. */\n    public Builder priority(Priority priority) {\n      if (priority == null) {\n        throw new IllegalArgumentException(\"Priority invalid.\");\n      }\n      if (this.priority != null) {\n        throw new IllegalStateException(\"Priority already set.\");\n      }\n      this.priority = priority;\n      return this;\n    }\n\n    /**\n     * Add a custom transformation to be applied to the image.\n     * <p>\n     * Custom transformations will always be run after the built-in transformations.\n     */\n    public Builder transform(com.didichuxing.doraemonkit.picasso.Transformation transformation) {\n      if (transformation == null) {\n        throw new IllegalArgumentException(\"Transformation must not be null.\");\n      }\n      if (transformation.key() == null) {\n        throw new IllegalArgumentException(\"Transformation key must not be null.\");\n      }\n      if (transformations == null) {","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/didi/DoKit/blob/626827cddb2feb2f3aee87a52a064b4e5ca2bed4/Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java#L396-L432","documentation":"Thrown by Request.Builder.priority(Priority) when a priority was already set on this builder. Picasso treats a repeated priority as a likely bug (each call would silently override the previous one), so the second call is rejected with IllegalStateException.","triggerScenarios":"Calling .priority(Priority.HIGH).priority(Priority.LOW), or priority() being applied in shared setup code and again at the call site.","commonSituations":"A base helper that sets a default priority, then request-specific code sets another; copy-pasted chains where priority appears twice; loops that reuse and re-configure a builder.","solutions":["Set the priority exactly once per request; remove the duplicate call.","If a default is needed, apply it only when none was set (track it in your own wrapper field).","Search your code for '.priority(' appearing twice on the same builder chain."],"exampleFix":"// before\npublic RequestCreator load(String url) {\n  return picasso.load(url).priority(Priority.NORMAL);\n}\nload(url).priority(Priority.HIGH); // second call throws\n\n// after\npublic RequestCreator load(String url) {\n  return picasso.load(url); // no default priority\n}\nload(url).priority(Priority.HIGH); // single call","handlingStrategy":"validation","validationCode":"// Track whether your code already applied a priority\nif (!priorityApplied) { builder.priority(p); priorityApplied = true; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call priority() at most once per request.","Do not set default priorities in shared helpers and again at call sites."],"tags":["android","picasso","builder","state-conflict","api-misuse"],"backgroundTag":null,"analyzedSha":"626827cddb2feb2f3aee87a52a064b4e5ca2bed4","analyzedAt":"2026-08-14T12:45:58.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}