{"record":{"id":"9c3b981cded43fbe","repo":"apache/hadoop","slug":"failed-to-create-link-either-because-the-filena","errorCode":null,"errorMessage":"failed to create link {} either because the filename is invalid or the file exists","messagePattern":"failed to create link (.+?) either because the filename is invalid or the file exists","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirSymlinkOp.java","lineNumber":65,"sourceCode":"      throw new InvalidPathException(\"Invalid target name: \" + target);\n    }\n\n    if (NameNode.stateChangeLog.isDebugEnabled()) {\n      NameNode.stateChangeLog.debug(\"DIR* NameSystem.createSymlink: target=\"\n          + target + \" link=\" + link);\n    }\n\n    FSPermissionChecker pc = fsn.getPermissionChecker();\n    INodesInPath iip;\n    fsd.writeLock();\n    try {\n      iip = fsd.resolvePath(pc, link, DirOp.WRITE_LINK);\n      link = iip.getPath();\n      if (!createParent) {\n        fsd.verifyParentDir(iip);\n      }\n      if (!fsd.isValidToCreate(link, iip)) {\n        throw new IOException(\n            \"failed to create link \" + link +\n                \" either because the filename is invalid or the file exists\");\n      }\n      if (fsd.isPermissionEnabled()) {\n        fsd.checkAncestorAccess(pc, iip, FsAction.WRITE);\n      }\n      // validate that we have enough inodes.\n      fsn.checkFsObjectLimit();\n\n      // add symbolic link to namespace\n      addSymlink(fsd, link, iip, target, dirPerms, createParent, logRetryCache);\n    } finally {\n      fsd.writeUnlock();\n    }\n    NameNode.getNameNodeMetrics().incrCreateSymlinkOps();\n    return fsd.getAuditFileInfo(iip);\n  }\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirSymlinkOp.java#L47-L83","documentation":"Error \"failed to create link {} either because the filename is invalid or the file exists\" thrown in apache/hadoop.","triggerScenarios":"Creating a symlink fails because the link name is invalid or an inode already exists at that path.","commonSituations":"See trigger scenarios.","solutions":["Ensure the link name is valid and does not already exist; remove the existing entry or choose another name."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}