{"record":{"id":"ab6fa7991b2ca98c","repo":"apache/hadoop","slug":"parent-directory-doesn-t-exist-parent","errorCode":null,"errorMessage":"Parent directory doesn't exist: \" + parent","messagePattern":"Parent directory doesn't exist: \" \\+ parent","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java","lineNumber":236,"sourceCode":"   * @throws IOException if an I/O error occurs\n   */\n  @Override\n  public FSDataOutputStream createNonRecursive(Path f,\n      FsPermission permission, boolean overwrite,\n      int bufferSize, short replication, long blockSize,\n      Progressable progress) throws IOException {\n    Path absolutePath = makeAbsolute(f);\n    Path parent = absolutePath.getParent();\n\n    if (parent != null && !parent.isRoot()) {\n      try {\n        FileStatus parentStatus = getFileStatus(parent);\n        if (!parentStatus.isDirectory()) {\n          throw new FileAlreadyExistsException(\n              parent + \" is a file\");\n        }\n      } catch (FileNotFoundException e) {\n        throw new FileNotFoundException(\n            \"Parent directory doesn't exist: \" + parent);\n      }\n    }\n\n    return create(f, permission, overwrite, bufferSize,\n        replication, blockSize, progress);\n  }\n\n  /**\n   * Create a file non-recursively with CreateFlag set.\n   *\n   * @param f the file name to create\n   * @param permission the permission to set\n   * @param flags creation flags\n   * @param bufferSize the buffer size\n   * @param replication the replication factor\n   * @param blockSize the block size\n   * @param progress for reporting progress","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java#L218-L254","documentation":"TypedBytesInput.readRaw() is the low-level variant that returns the raw typed-bytes encoding (including the type byte) instead of a Java object. It accepts the same code set as read() — core types, LIST/MAP/VECTOR raw forms, MARKER returning null, and 50-200 application codes via readRawBytes(code) — and throws RuntimeException 'unknown type' for any other leading byte. As with read(), the exception signals stream misalignment or a non-typed-bytes source rather than a fixable type problem.","triggerScenarios":"Calling readRaw() on desynchronized input: after skipping only part of a previous record, reading a stream produced by a text writer, or consuming bytes produced by readRawBytes for a custom code your reader build does not understand (codes >200 other than 255).","commonSituations":"Custom InputFormat/RecordReader built on TypedBytesInput.readRaw() for pipes; feeding files from a different serialization (Hadoop Writable files, raw text) into it; partial reads where the caller consumed the type byte separately and then calls readRaw again mid-record.","solutions":["Verify framing integrity: every readRaw() must start exactly at a record boundary — audit any manual in.skip()/read() between records.","Ensure the producer writes with TypedBytesOutput (or a spec-compliant writer) and that both sides use the same typed-bytes dialect.","For custom protocols keep codes within 50-200 so readRaw() returns them as raw bytes instead of throwing.","Debug by hex-dumping bytes around the failure offset to find the first desynchronized record and fix the writer side."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  Buffer b = tIn.readRaw();\n} catch (RuntimeException e) {\n  if (\"unknown type\".equals(e.getMessage())) {\n    // resync logic: drop to next known boundary or fail the split\n    throw new IOException(\"typed-bytes raw stream out of sync\", e);\n  }\n  throw e;\n}","preventionTips":["Read whole records only; never partial-skip between readRaw calls.","Validate the producer uses TypedBytesOutput with the same dialect.","Hex-dump at the failure offset to find the first bad record."],"tags":["hadoop","typedbytes","serialization","unknown-type","raw-io"],"backgroundTag":"deserialization-type-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}