Repository becomes unbrowseable after pushing a file with a whitespace-only filename

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: High
    • None
    • Affects Version/s: 9.4.13
    • Component/s: Mesh
    • None
    • 1
    • Severity 3 - Minor
    • 6

      Issue Summary

      A git tree entry whose filename is pure whitespace (e.g. a single space character) is valid per git's object model. However, Bitbucket Mesh rejects it with IllegalArgumentException: A non-blank path is required, which surfaces as gRPC Status.UNKNOWN with no description. The repository becomes completely unbrowseable in the UI (500 / "UNKNOWN") on /browse, /files, and PR diffs until the entry is removed.

      In previous versions of Bitbucket the /browse UI did handle whitespace only filenames, for example here is a screenshot from Bitbucket 7.6.23:

      Analysis of the code suggest it is likely the regression first shipped in Bitbucket 8.0

      Steps to Reproduce

      1. Clone any existing repository from a Bitbucket DC instance
      2. Create a regular file whose name is a single space character:
        echo "test" > ' '
        
      3. Stage, commit, and push:
        git add ' '
        git commit -m "add whitespace-only filename"
        git push origin master
        
      4. Browse the repository in the Bitbucket UI (/browse, /files, or any PR diff containing this commit)

      Expected Results

      Bitbucket should either:

      • Display the entry (git considers it valid), or
      • Return a meaningful gRPC error status with a descriptive message (e.g. INVALID_ARGUMENT: tree entry contains a blank filename) instead of UNKNOWN: null

      Actual Results

      The below exception is thrown in the Mesh log file (atlbitbucket-mesh.log or atlassian-bitbucket.log for embedded Mesh):

      2026-05-12 23:03:05,659 WARN  [grpc-async:thread-4] admin AC5KMVRPx1383x262x2 @IGU6TEx1383x334x0 127.0.0.1 "ContentService/ListDirectory" (>1 <0) c.a.b.m.g.LoggingServerInterceptor RPC failed with an UNKNOWN error: null
      java.lang.IllegalArgumentException: A non-blank path is required
        at com.atlassian.bitbucket.mesh.util.BuilderSupport.requireNonBlank(BuilderSupport.java:83)
        at com.atlassian.bitbucket.mesh.git.content.File$Builder.<init>(File.java:69)
        at com.atlassian.bitbucket.mesh.git.builder.lstree.DirectoryLsTreeStdioHandler.parse(DirectoryLsTreeStdioHandler.java:100)
        at com.atlassian.bitbucket.mesh.git.builder.lstree.DirectoryLsTreeStdioHandler.onStdout(DirectoryLsTreeStdioHandler.java:65)
        at com.atlassian.bitbucket.mesh.process.handler.LineDecoder.offerLine(LineDecoder.java:173)
        at com.atlassian.bitbucket.mesh.process.handler.LineDecoder.forEach(LineDecoder.java:128)
        at com.atlassian.bitbucket.mesh.process.handler.LineOutputAdapter.onBytes(LineOutputAdapter.java:125)
        at com.atlassian.bitbucket.mesh.process.handler.AbstractLineStdioHandler.onStdout(AbstractLineStdioHandler.java:72)
        at com.atlassian.bitbucket.mesh.git.content.DefaultContentManager.listDirectory(DefaultContentManager.java:117)
        at com.atlassian.bitbucket.mesh.git.GrpcContentService.lambda$listDirectory$0(GrpcContentService.java:61)
        at com.atlassian.bitbucket.mesh.execution.DefaultGrpcAsyncExecutor$GrpcTask.run(DefaultGrpcAsyncExecutor.java:62)
      

      The error fires on every browse attempt. The entire repository is rendered unbrowseable for all users including admins.

      Workaround

      Remove the whitespace-only filename entry from the repository:

      git rm -- ' '
      git commit -m "remove whitespace-only filename"
      git push origin master
      

      The repository will become browseable again immediately after the push.

              Assignee:
              Unassigned
              Reporter:
              Ravi Reddy Gannavarapu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: