Forum Discussion
Dynamic M query parameter binding to a query table which uses import mode
- 5 months ago
Hi Sanjota07 ,
Non-null assertion failure: resource: Resource should be available for query Query2 to store FoldedArtifacts in cache This corresponds to that the pbi engine cant fold the entire query in direct query mode so this flag is raised
You can also try this approach :
let
Source = Sql.Database("",""),
PrCase = Source{[Schema = "dbo", Item = "Table"]}[Data],
FilteredRows = Table.SelectRows(PrCase, each [Active] = #"Active")
in
FilteredRows
Thanks
Hello Natarajan_M
I have followed your steps and I got option to select the storage mode, after selecting storage mode I am getting an error once I cancel the error the data gets loaded without any issue and the storage mode is also direct query only but when I hover over the table I can see unknown server and unknown database.
Can you click on the copy details to clipboard and share the details Sanjota05 ?
I think the error is related to query folding ,can you check if your query is getting folded or not ?
Thanks
- Sanjota075 months agoNew Member
Hi Natarajan_M
Feedback Type:
Frown (Error)Timestamp:
2026-03-19T06:15:53.6721040ZLocal Time:
2026-03-19T06:15:53.6721040+00:00Session ID:
eabb1f69-96f5-464d-9b7b-9f37cb016647Release:
August 2025Product Version:
2.146.1254.0 (25.08)+791a7518fadc83da883d79322a2658aff57c8db3 (x64)Error Message:
Non-null assertion failure: resource: Resource should be available for query Query2 to store FoldedArtifacts in cacheStack Trace:
System.ArgumentException
at Microsoft.PowerBI.Modeling.Common.Contract.FailArgumentCore(String msg)
at Microsoft.PowerBI.Client.Windows.QueryFolding.FoldedArtifactsGenerator.GenerateAndAddArtifactsForEvaluatedQueries(IReadOnlyDictionary`2 queriesAndFoldedArtifacts, IDataModel model, IReadOnlyDictionary`2 queryDependencyGraph, IReadOnlyDictionary`2 queryResourceMap)
at Microsoft.PowerBI.Client.Windows.Modeling.Hosting.DesktopModelingHost.<LoadToModel>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.<>c__DisplayClass44_0.<<StartLoadToReportFlow>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Mashup.Client.UI.Shared.IExceptionHandlerExtensions.<HandleAwaitableAsyncExceptions>d__1.MoveNext()Stack Trace Message:
Non-null assertion failure: resource: Resource should be available for query Query2 to store FoldedArtifacts in cacheInvocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.GetStackTraceInfo(Exception e)
at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.ReportException(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, Boolean useGDICapture)
at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.<>c__DisplayClass14_0.<HandleException>b__0()
at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.HandleException(Exception e)
at Microsoft.PowerBI.Client.PowerBIUnexpectedExceptionHandler.HandleException(Exception e)
at Microsoft.Mashup.Client.UI.Shared.IExceptionHandlerExtensions.<HandleAwaitableAsyncExceptions>d__1.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)
at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)
at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.<>c__DisplayClass44_0.<<StartLoadToReportFlow>b__0>d.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)
at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)
at Microsoft.PowerBI.Client.Windows.Modeling.Hosting.DesktopModelingHost.<LoadToModel>d__17.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)
at Microsoft.PowerBI.Modeling.Engine.Authoring.AsyncModelAuthoringService.<ContinueWithAsyncOperation>d__13.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
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.UI.Windows.DialogWindowBase.ShowModal(IWindowHandle windowHandle)
at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.Windows.Services.PowerBIWindowService.<>c__DisplayClass10_0.<Microsoft.Mashup.Client.UI.Shared.Ux.IWindowService.ShowDialog>b__0()
at Microsoft.PowerBI.Client.Windows.Services.PowerBIWindowService.Trace[T](String action, String title, String details, Func`1 showDialog, Func`2 getResult)
at Microsoft.PowerBI.Client.Windows.Services.PowerBIWindowService.Trace(String action, String title, String details, Func`1 showDialog)
at Microsoft.PowerBI.Client.Windows.Services.PowerBIWindowService.Microsoft.Mashup.Client.UI.Shared.Ux.IWindowService.ShowDialog(IDialog dialog)
at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.<>c__DisplayClass20_0.<ShowDialog>b__0()
at Microsoft.PowerBI.Client.Windows.Services.TelemetryHelper.RunInActivity[T](IPowerBITelemetryService telemetryService, ITelemetryEvent telemetryEvent, Func`1 action)
at Microsoft.PowerBI.Client.Windows.Services.LoadToReportDialogManager.Show(ILegacyUIHost uiHost, IExceptionHandler exceptionHandler, IPowerBIWindowService windowService, IPowerBIQueryErrorEditor queryErrorEditor, LoadToModelContext loadToModelContext, LocalizedString title)
at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.<>c__DisplayClass19_0.<TryShowDialogForQueries>b__0()
at Microsoft.PowerBI.Client.Windows.Report.<>c__DisplayClass82_0`1.<SynchronizeLooselyWithQueries>b__0()
at Microsoft.PowerBI.Client.Windows.Report.<SynchronizeLooselyWithQueriesAsync>d__83`1.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.PowerBI.Client.Windows.Report.SynchronizeLooselyWithQueriesAsync[T](Func`1 getTask)
at Microsoft.PowerBI.Client.Windows.Report.SynchronizeLooselyWithQueries[T](Func`1 action)
at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.TryShowDialogForQueries(Report report, IExceptionHandler exceptionHandler, IPowerBIWindowService windowService, IPowerBIQueryErrorEditor queryErrorEditor, IEnumerable`1 queriesToApply, String loadReason, ITelemetryService modelingTelemetryService, QueryLoadStages queryLoadStages, LocalizedString title, Action`1 beforeSchemaSyncCallback, Action`1 afterSchemaSyncCallback, Boolean synchronizeLooselyWithQueries)
at Microsoft.PowerBI.Client.Windows.Services.LegacyMashupEditorService.ApplyQueryChanges(IEnumerable`1 queriesToLoad, ITelemetryService telemetryService)
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
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.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.AppModule.<>c__DisplayClass3_0.<Run>b__0()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.AppModule.Run()
at Microsoft.PowerBI.Client.Program.RunApplicationFlow(String[] args, IPowerBIRootTrace trace)
at Microsoft.PowerBI.Client.Program.Main(String[] args)
PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.146.1254.0","ModuleName":"Microsoft.PowerBI.Modeling.Common.dll","Component":"Microsoft.PowerBI.Modeling.Common.Contract","Error":"System.ArgumentException","MethodDef":"FailArgumentCore","ErrorOffset":"28","ErrorCode":""}OS Version:
Microsoft Windows NT 10.0.17763.0 (x64 en-US)CLR Version:
4.7.2 or later [Release Number = 461814]Peak Virtual Memory:
86.8 GBPrivate Memory:
545 MBPeak Working Set:
740 MBIE Version:
11.1790.17763.0User ID:
26c8085f-d7f8-4103-80af-1449c307da40Workbook Package Info:
1* - en-US, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.Telemetry Enabled:
TrueSnapshot Trace Logs:
C:\Users\xpPBIMigInfosys_f25\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShotfa82b1b4-9370-42e3-90ba-303191951c4f.zipModel Default Mode:
CompositeModel Version:
PowerBI_V3Performance Trace Logs:
C:\Users\xpPBIMigInfosys_f25\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zipEnabled Preview Features:
PBI_googleBigQueryAdbcVersionEnabled
PBI_shapeMapVisualEnabled
PBI_enhancedTooltips
PBI_scorecardVisual
PBI_setLabelOnExportPdf
PBI_oneDriveSave
PBI_oneDriveShare
PBI_odspSaveBackgroundUpload
PBI_modernOfficeFilePicker
PBI_useModernPublishDialogs
PBI_gitIntegration
PBI_tmdlInDataset
PBI_directLakeRemoteModeling
PBI_directLakeOnOneLake
PBI_newCard
PBI_buttonSlicerAuthoring
PBI_advancedSlicerTypeList
PBI_textSlicer
PBI_daxInlineCopilot
PBI_aiNarrativesVisual
PBI_visualCalculationsAuthoring
PBI_tmdlViewToggle
PBI_copilotUnifiedTooling
PBI_UserInstalledVerticaODBCDriver
PBI_sqlDbNativeArtifactsOnDesktopDisabled Preview Features:
PBI_SpanishLinguisticsEnabled
PBI_qnaLiveConnect
PBI_metricsArtifactsOnDesktop
PBI_b2bExternalDatasetSharing
PBI_onObject
PBI_publishDialogsSupportSubfolders
PBI_enhancedReportFormat
PBI_qnaImproveLsdlCopilot
PBI_UserInstalledNetezzaODBCDriver
MashupFlight_EnableOracleBundledOdacProvider
PBI_dataFunctionActionsDisabled DirectQuery Options:
TreatHanaAsRelationalSourceCloud:
GlobalCloudPowerBIUserFeedbackServices_IsReported:
TrueDPI Scale:
100%Supported Services:
Power BIFormulas:
section Section1;shared Query1 = let
Source = ""
in
Source;shared Query2 = let
Source = Sql.Database(
"dalsql080.NA.XOM.COM",
"PIMS_API_DB"
),
Result = Value.NativeQuery(
Source,
"SELECT * from PrCase
WHERE SolutionID ='498284604'"
)
in
Result;WebView2 Runtime Version:
146.0.3856.62WebView2 SDK Version:
1.0.2365.46
The query which I used is the below one, where I haven't used the parameters yet
let
Source = Sql.Database(
"",
""
),
Result = Value.NativeQuery(
Source,
"SELECT * from PrCase
WHERE SolutionID ='498284604'"
)
in
Result
Thank you!- Natarajan_M5 months agoSuper User
Hi Sanjota07 ,
Non-null assertion failure: resource: Resource should be available for query Query2 to store FoldedArtifacts in cache This corresponds to that the pbi engine cant fold the entire query in direct query mode so this flag is raised
You can also try this approach :
let
Source = Sql.Database("",""),
PrCase = Source{[Schema = "dbo", Item = "Table"]}[Data],
FilteredRows = Table.SelectRows(PrCase, each [Active] = #"Active")
in
FilteredRows
Thanks