Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
anttipekkarinen
New Member

Error: Block length does not match with its complement.

Hi,

 

I'm getting this error when trying to open a specific pbix file with Power BI Desktop. Any ideas how to solve this?

 

 

 

Error Message:

 

Block length does not match with its complement.

 

Stack Trace:

 

System.IO.InvalidDataException: Block length does not match with its complement.

 

Server stack trace:

   at System.IO.Compression.Inflater.DecodeUncompressedBlock(Boolean& end_of_block)

   at System.IO.Compression.Inflater.Decode()

   at System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length)

   at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)

   at MS.Internal.IO.Packaging.CompressStream.Read(Byte[] buffer, Int32 offset, Int32 count)

   at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)

   at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)

   at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)

   at Microsoft.PowerBI.Packaging.Extensions.StreamExtensions.ReadAllBytes(Stream stream)

   at Microsoft.PowerBI.Packaging.PowerBIPackagingUtils.GetContentAsBytes(IStreamablePowerBIPackagePartContent streamablePowerBIPackagePartContent, Boolean isOptional)

   at Microsoft.PowerBI.Client.Windows.Services.ReportFactory.CreateReportFromPowerBIPackage(IPowerBIPackage powerBIPackage, Byte[] securityBindings, Boolean requiresConversionToReportLayout, IPowerBITelemetryService powerBITelemetryService, PackageValidationResult& mashupValidationResult)

   at Microsoft.PowerBI.Client.Windows.Services.FileManager.OpenFile(String filePath, Stream fileStream, Boolean isReadOnly)

   at Microsoft.PowerBI.Client.Windows.Services.FileManager.OpenFile(String filePathToOpen, IWin32Window ownerWindow, ReportUpgradeResult& upgradeResult)

   at Microsoft.PowerBI.Client.Windows.MainWindow.<>c__DisplayClass1f.<OpenFile>b__1d()

   at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.<>c__DisplayClass1.<BlockUIAndRunAsync>b__0()

   at System.Threading.Tasks.Task.Execute()

 

Exception rethrown at [0]:

   at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.WaitOnUIThreadForTaskCompletion(Task task)

   at Microsoft.PowerBI.Client.Windows.MainWindow.OpenFile(TelemetryUserActionId entryPoint, String filePath, Boolean fromRecentFile)

   at Microsoft.PowerBI.Client.Windows.MainWindow.OpenDocument(TelemetryUserActionId entryPoint, String testFilePath)

   at Microsoft.PowerBI.Client.Windows.Ribbon.EditorRibbonCommandActionHandler.HandleCommand(UInt32 commandId)

   at Microsoft.Mashup.Client.Windows.Ribbon.RibbonCommandHandler.Execute(UInt32 commandId, CommandExecutionVerb verb, PropertyKeyRef keyRef, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties)

 

Invocation Stack Trace:

 

   at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()

   at Microsoft.Mashup.Client.ClientShared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace)

   at Microsoft.Mashup.Client.ClientShared.FeedbackErrorInfo..ctor(String message, Nullable`1 errorCode, String requestId, Exception exception)

   at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.<>c__DisplayClass1.<HandleException>b__0()

   at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.HandleException(Exception e)

   at Microsoft.PowerBI.Client.Windows.Utilities.UIBlockingAwareExceptionHandler.HandleException(Exception e)

   at Microsoft.Mashup.Client.Windows.Ribbon.RibbonCommandHandler.Execute(UInt32 commandId, CommandExecutionVerb verb, PropertyKeyRef keyRef, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties)

   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

   at Microsoft.Mashup.Client.ClientShared.WindowManager.ShowDialog[T](T form, IWin32Window owner)

   at Microsoft.PowerBI.Client.Program.<>c__DisplayClassc.<Main>b__0()

   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

   at Microsoft.PowerBI.Client.Program.Main(String[] args)

 

 

3 REPLIES 3
v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi anttipekkarinen,

System.IO.InvalidDataException function means that a compressed data stream is in a format that is not valid.

Reference: https://msdn.microsoft.com/en-us/library/ms241600.aspx

Besides, could you please share more details about the special PBIX file, was it compressed?

In addition, check to see if the following article would help:

http://george.chiramattel.com/blog/2007/09/deflatestream-block-length-does-not-match.html

Regards

Hi,

 

I have the same problem, see the details copied below. My pbix file got corrupted after i renamed the file. After renaming it back, it was still corrupted. Any idea what may have caused this?

 

Thanks!

 

David

 

Error Message:

 

Block length does not match with its complement.

 

Stack Trace:

 

System.IO.InvalidDataException: Block length does not match with its complement.

   at System.IO.Compression.Inflater.DecodeUncompressedBlock(Boolean& end_of_block)

   at System.IO.Compression.Inflater.Decode()

   at System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length)

   at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)

   at MS.Internal.IO.Packaging.CompressStream.Read(Byte[] buffer, Int32 offset, Int32 count)

   at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Read(Byte[] buffer, Int32 offset, Int32 count)

   at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 count)

   at System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize)

   at Microsoft.PowerBI.Packaging.Extensions.StreamExtensions.ReadAllBytes(Stream stream)

   at Microsoft.PowerBI.Packaging.PowerBIPackagingUtils.GetContentAsBytes(IStreamablePowerBIPackagePartContent streamablePowerBIPackagePartContent, Boolean isOptional)

   at Microsoft.PowerBI.Client.Windows.Services.ReportFactory.CreateReportFromPowerBIPackage(IPowerBIPackage powerBIPackage, Byte[] securityBindings, Boolean requiresConversionToReportLayout, IPowerBITelemetryService powerBITelemetryService, PackageValidationResult& mashupValidationResult)

   at Microsoft.PowerBI.Client.Windows.Services.FileManager.OpenFile(String filePath, Stream fileStream, Boolean isReadOnly)

   at Microsoft.PowerBI.Client.Windows.Services.FileManager.OpenFile(String filePathToOpen, IWin32Window ownerWindow, ReportUpgradeResult& upgradeResult)

   at Microsoft.PowerBI.Client.Program.TryOpenOrCreateReport(WindowsHost windowsHost, ISplashScreen splashScreen, IFileManager fileManager, IFileHistoryManager fileHistoryManager, IPowerBIStringProvider stringProvider, String filePath, PBIWinLoadPBIAppAction loadEvent, Report& report, String& importFromExcelFilePath, String& templateFilePath, String& autoRecoveredFilePath, ReportUpgradeResult& upgradeResult)

   at Microsoft.PowerBI.Client.Program.<>c__DisplayClassb.<Main>b__0()

   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

 

Invocation Stack Trace:

 

   at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()

   at Microsoft.Mashup.Client.ClientShared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace)

   at Microsoft.Mashup.Client.ClientShared.FeedbackErrorInfo..ctor(String message, Nullable`1 errorCode, String requestId, Exception exception)

   at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.<>c__DisplayClass1.<HandleException>b__0()

   at Microsoft.Mashup.Client.ClientShared.UnexpectedExceptionHandler.HandleException(Exception e)

   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

   at Microsoft.PowerBI.Client.Program.Main(String[] args)

 

 

Hi, Is there any way to fix this issue.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.