{"record":{"id":"43dc0d405f34ce58","repo":"apache/hadoop","slug":"dfs-client-does-not-support-blockid","errorCode":null,"errorMessage":"DFS client does not support blockId","messagePattern":"DFS client does not support blockId","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlock.java","lineNumber":122,"sourceCode":"   * @return the offset of the block.\n   */\n  public Long getOffset() {\n    return offset;\n  }\n\n  @Override\n  public void close() throws IOException {\n    if (activeBlock != null) {\n      activeBlock.close();\n    }\n  }\n\n  /**\n   * Returns blockId for the block.\n   * @return blockId.\n   */\n  public String getBlockId() {\n    throw new IllegalArgumentException(\"DFS client does not support blockId\");\n  }\n\n  /**\n   * Gets the AbfsOutputStream.\n   *\n   * @return the AbfsOutputStream.\n   */\n  public AbfsOutputStream getOutputStream() {\n    return outputStream;\n  }\n\n  /**\n   * Sets the AbfsOutputStream.\n   *\n   * @param outputStream the AbfsOutputStream to set.\n   */\n  public void setOutputStream(final AbfsOutputStream outputStream) {\n    this.outputStream = outputStream;","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlock.java#L104-L140","documentation":"AbfsBlock.getBlockId() unconditionally throws IllegalArgumentException. Block IDs exist only for blob-endpoint 'stage block' uploads (AbfsBlobBlock); a plain AbfsBlock belongs to the DFS (abfs://) client, which streams via append and has no block-id concept. Calling this method is a type misuse, not a runtime storage failure.","triggerScenarios":"Code that downcasts or handles AbfsBlock generically and calls getBlockId() — e.g. committing staged blocks — while the stream was created against the dfs (abfs://) endpoint rather than the blob endpoint.","commonSituations":"Custom output committers or instrumentation walking AbfsOutputStream blocks; refactors that assume blob-endpoint semantics on HNS accounts using the dfs endpoint; code paths shared between AbfsClient and AbfsBlobClient.","solutions":["Branch on the concrete block/client type: only AbfsBlobBlock (blob endpoint) exposes a valid blockId.","Prefer instanceof checks over blind casts to AbfsBlobBlock before any block-id API.","Confirm which endpoint the filesystem uses (abfs:// dfs vs blob endpoint) and route block-id logic accordingly."],"exampleFix":"// before\nfor (AbfsBlock b : blocks) { commitBlockId(b.getBlockId()); } // DFS blocks throw\n// after\nfor (AbfsBlock b : blocks) {\n  if (b instanceof AbfsBlobBlock) {\n    commitBlockId(((AbfsBlobBlock) b).getBlockId());\n  }\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"if (block instanceof AbfsBlobBlock) {\n  String id = ((AbfsBlobBlock) block).getBlockId();\n} else {\n  // DFS-endpoint block: no blockId concept, use append path\n}","tryCatchPattern":"try { useBlockId(block.getBlockId()); }\ncatch (IllegalArgumentException ex) {\n  if (ex.getMessage().contains(\"does not support blockId\")) { /* wrong endpoint type */ }\n  else throw ex;\n}","preventionTips":["Branch on concrete block type before block-id APIs.","Know which endpoint each filesystem instance uses (abfs:// dfs vs blob endpoint) before writing committer logic.","Cover both endpoint types in unit tests for shared stream code."],"tags":["azure","abfs","dfs","block","unsupported-operation","misuse"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}