{"record":{"id":"f399a544c6ef2f5e","repo":"didi/DoKit","slug":"unrecognized-type-of-request-request","errorCode":null,"errorMessage":"Unrecognized type of request: \" + request","messagePattern":"Unrecognized type of request: \" \\+ request","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/BitmapHunter.java","lineNumber":66,"sourceCode":"   * well as potential OOMs. Shamelessly stolen from Volley.\n   */\n  private static final Object DECODE_LOCK = new Object();\n\n  private static final ThreadLocal<StringBuilder> NAME_BUILDER = new ThreadLocal<StringBuilder>() {\n    @Override protected StringBuilder initialValue() {\n      return new StringBuilder(Utils.THREAD_PREFIX);\n    }\n  };\n\n  private static final AtomicInteger SEQUENCE_GENERATOR = new AtomicInteger();\n\n  private static final RequestHandler ERRORING_HANDLER = new RequestHandler() {\n    @Override public boolean canHandleRequest(Request data) {\n      return true;\n    }\n\n    @Override public Result load(Request request, int networkPolicy) throws IOException {\n      throw new IllegalStateException(\"Unrecognized type of request: \" + request);\n    }\n  };\n\n  final int sequence;\n  final DokitPicasso picasso;\n  final Dispatcher dispatcher;\n  final Cache cache;\n  final Stats stats;\n  final String key;\n  final Request data;\n  final int memoryPolicy;\n  int networkPolicy;\n  final RequestHandler requestHandler;\n\n  Action action;\n  List<Action> actions;\n  Bitmap result;\n  Future<?> future;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/didi/DoKit/blob/626827cddb2feb2f3aee87a52a064b4e5ca2bed4/Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/BitmapHunter.java#L48-L84","documentation":"BitmapHunter's static ERRORING_HANDLER is used as the request handler when forRequest() finds no registered RequestHandler whose canHandleRequest(Request) returns true. Its load() always throws IllegalStateException('Unrecognized type of request: ' + request), so the exception surfaces on the hunter thread (or via the request pipeline) with the full request dump. It is Picasso's way of turning 'no handler for this URI/data type' into an explicit, diagnosable failure instead of a silent no-op.","triggerScenarios":"Calling picasso.load(uri) with a scheme no handler covers (custom scheme, malformed http URI, unknown content:// authority) while custom RequestHandlers added via Builder.addRequestHandler all return false from canHandleRequest; the ERRORING_HANDLER is also returned for requests that fail handler resolution before hunting starts.","commonSituations":"Loading a file path string that parses to a URI with no scheme; app-specific uri:// scheme with the custom handler forgotten or its canHandleRequest logic buggy; media store URIs on devices where the contacts/media handler does not match.","solutions":["Inspect the message's request dump: check the uri scheme and resourceId fields to see why nothing matched","For custom schemes, register a handler: new DokitPicasso.Builder(context).addRequestHandler(new MySchemeHandler()).build() with canHandleRequest returning true for that scheme","Fix the URI itself, e.g. use Uri.fromFile(file) or a well-formed https:// URL","If you meant a resource, use load(R.drawable.x) rather than load(\"res://...\") style strings"],"exampleFix":"// before\nDokitPicasso.with(context).load(Uri.parse(\"myapp://avatar/42\")).into(view);\n// -> IllegalStateException: Unrecognized type of request\n\n// after\nclass MyAppRequestHandler extends RequestHandler {\n  @Override public boolean canHandleRequest(Request data) {\n    return \"myapp\".equals(data.uri.getScheme());\n  }\n  @Override public Result load(Request request, int networkPolicy) throws IOException {\n    return new Result(decodeMyAppAsset(request.uri), Picasso.LoadedFrom.DISK);\n  }\n}\nDokitPicasso picasso = new DokitPicasso.Builder(context)\n    .addRequestHandler(new MyAppRequestHandler()).build();\npicasso.load(Uri.parse(\"myapp://avatar/42\")).into(view);","handlingStrategy":"validation","validationCode":"// Validate the URI against the schemes your handlers actually support before loading.\nstatic boolean isLoadable(Uri uri) {\n  if (uri == null) return false;\n  String s = uri.getScheme();\n  return \"http\".equals(s) || \"https\".equals(s) || \"file\".equals(s)\n      || \"content\".equals(s) || \"android.resource\".equals(s) || \"myapp\".equals(s);\n}\nif (isLoadable(uri)) picasso.load(uri).into(view); else view.setImageResource(placeholder);","typeGuard":null,"tryCatchPattern":"// The throw happens on a hunter/dispatch thread; surface it via the request callback instead:\npicasso.load(uri)\n    .error(R.drawable.broken)\n    .into(view, new Callback() {\n      @Override public void onSuccess() {}\n      @Override public void onError(Exception e) {\n        if (e instanceof IllegalStateException\n            && e.getMessage() != null && e.getMessage().contains(\"Unrecognized type of request\")) {\n          Log.e(TAG, \"No RequestHandler for \" + uri, e);\n        }\n      }\n    });","preventionTips":["Register a RequestHandler for every custom scheme your app loads","Log the request dump from the message — the uri field shows exactly what failed to match","Build URIs with Uri.parse on validated strings or Uri.fromFile for files"],"tags":["android","picasso","image-loading","uri"],"backgroundTag":null,"analyzedSha":"626827cddb2feb2f3aee87a52a064b4e5ca2bed4","analyzedAt":"2026-08-14T12:45:58.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}