Reload all configurations failure with endpointdocumentation

Resolved

Reload all configurations failure with endpointdocumentation

avatar

We are using PSU modules and when i reload all configurations then i get standard this error:

[11:33:08 ERR] UniversalAutomation.Services.ConfigurationScript Failed to read configuration file. endpointDocumentation.ps1

Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.

---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.

at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)

at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()

at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)

at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)

--- End of inner exception stack trace ---

at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)

at PowerShellUniversal.Extensibility.EFTable`2.SaveWithRetryAsync(DbContext context) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.Extensibility\Persistence\EFTable.cs:line 1032

at PowerShellUniversal.Extensibility.EFTable`2.SaveWithRetryAsync(DbContext context) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.Extensibility\Persistence\EFTable.cs:line 1038

at PowerShellUniversal.Extensibility.EFTable`2.DeleteAsync(T item) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.Extensibility\Persistence\EFTable.cs:line 228

at PowerShellUniversal.Extensibility.EFTable`2.DeleteAsync(T item) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.Extensibility\Persistence\EFTable.cs:line 228

at PowerShellUniversal.Configuration.EndpointDocumentationService.DeleteAsync(ModelOperationContext`1 context) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.Configuration\EndpointDocumentation.cs:line 75

at UniversalAutomation.Services.ConfigurationScript`1.ReadAsync(SyncContext syncContext, CancellationToken cancellationToken) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal\ConfigurationScript.cs:line 391

In this modules we are creating endpoints with their endpointdocumentations.

Running on IIS but also from my dev seat running throug a running universal.server.exe command from my powershell 7 shell.

avatar

Recommended Answer

Hello Romano,

Thank you for the detailed follow-up and the sample files, which made this much easier to trace.

The SQLite error does not come from your SQL Server database or from your SQLite database file.

PowerShell Universal keeps the resources it reads from the .universal files in a separate in-memory SQLite store.

That is why you see a SQLite error on both machines, and why your own database shows no endpoint or documentation rows.

Here is what happens during Reload All Configurations on 2026.3.3.

PowerShell Universal first reloads the repository's own endpointDocumentation.ps1 file.

Your documentation entries come from your modules, not from that file, so the reload treats them as removed and tries to delete them.

Your module endpoints still point to those entries through their Documentation parameter, so the store blocks the delete.

That blocked delete is the foreign key error in your log.

Because the delete is blocked, your documentation entries stay in place, which matches what you saw.

PowerShell Universal 2026.3.4, now available, changes this behavior.

A repository reload now leaves resources that belong to a module alone, and each module reload manages its own resources.

In the release notes, this fix is listed as "Fixed external modules disappearing after Git synchronization changes": https://devolutions.net/powershell-universal/release-notes/

The same change also covers manual reloads such as Reload All Configurations.

Could you upgrade your dev machine to 2026.3.4 and run Reload All Configurations again?

Please let me know whether the error is gone.

If it still appears, send me the new log entry and I will reproduce it on our side with your sample module.

Until then, the error does not remove anything, so you can leave it as is.

A restart remains the cleanest way to pick up module changes on 2026.3.3.

Endpoint documentation is described here: https://docs.devolutions.net/powershell-universal/api/openapi

Best regards,

Patrick Ouimet

All Comments (4)

avatar

Hello Romano,

Thank you for the report and for including the full stack trace.

The trace shows what fails, even if it does not yet show why.

During a full reload, PowerShell Universal reads endpointDocumentation.ps1 again.

It then tries to delete a documentation entry that it no longer finds.

The database blocks the delete because some endpoints still point to that entry.

Our working theory is that the documentation from your modules looks missing to the full reload.

Module resources are loaded when the service starts, so the reload may not see them.

We have not confirmed this yet, so I would like to reproduce it on our side.

Could you send the following?

The exact PowerShell Universal version on the IIS server and on your dev machine.

Whether the IIS server also uses the default SQLite database, or SQL Server or PostgreSQL.

Where New-PSUEndpointDocumentation is called: in each module's .universal folder, in the repository's own .universal folder, or in both.

A trimmed copy of one module's endpoints.ps1 and endpointDocumentation.ps1, with only the New-PSUEndpoint and New-PSUEndpointDocumentation lines (names and URLs can be masked).

Whether the error also appears after a clean restart, or only after Reload all configurations.

Whether you see any impact beyond the log entry, for example missing endpoints or missing Swagger pages.

In the meantime, a restart is the safer way to pick up module changes.

On IIS, that means recycling the application pool.

On your dev machine, it means stopping and starting Universal.Server.exe.

The module documentation explains that module resources are loaded at startup: https://docs.devolutions.net/powershell-universal/platform/modules

For reference, endpoint documentation is described here: https://docs.devolutions.net/powershell-universal/api/openapi

Best regards,

Patrick Ouimet

avatar

Hi Patrick,

Thank you for your response.

I find it strange that I am getting a SQL error, while there are no entries for endpoints or endpoint documentations in the SQL database when I check it.

  • I am running version 2026.3.3 (I was already experiencing this issue in earlier versions as well).

  • The IIS server uses a Microsoft SQL Server database, while my dev machine uses SQLite.

  • New-PSUEndpointDocumentation is called from the .universal folder in multiple modules.

  • Endpoints.ps1:

$Parameters = @{

Url = '/api/v1/test'

Description = 'test api for endpointdocumentation error'

Method = @('GET')

Module = 'powershelluniversal.test'

Command = 'Invoke-APITest'

Tag = @('Test')

Documentation = 'TEST'

}

New-PSUEndpoint @Parameters

In the Invoke-APITest function for the endpoint i have the synopsis:

<#

.SYNOPSIS

Test endpoint

.DESCRIPTION

Test endpoint for endpointdocumentation error

.OUTPUTS

200:

Description: Successful operation.

Content:

application/json: DSH_ComputerOutput

400:

Description: Bad Request

403:

Description: The user does not have permission to perform the operation.

500:

Description: Output from the error.

#>

  • EndpointDocumentation.ps1:

$Parameters = @{

Name = 'TEST'

Description = 'TEST Endpoint Documentation'

Definition = {

[Documentation()]

class TEST_Output {

[string]$Test

}

}

Url = '/doc/v1/test'

Version = 'v1'

}

New-PSUEndpointDocumentation @Parameters

  • I only see this happening when using Reload All Configurations.

  • I have not noticed anything missing or broken apart from the error message itself.

I hope this provides you with enough information to investigate the issue further.

Kind regards,

Romano

avatar

Hello Romano,

Thank you for the detailed follow-up and the sample files, which made this much easier to trace.

The SQLite error does not come from your SQL Server database or from your SQLite database file.

PowerShell Universal keeps the resources it reads from the .universal files in a separate in-memory SQLite store.

That is why you see a SQLite error on both machines, and why your own database shows no endpoint or documentation rows.

Here is what happens during Reload All Configurations on 2026.3.3.

PowerShell Universal first reloads the repository's own endpointDocumentation.ps1 file.

Your documentation entries come from your modules, not from that file, so the reload treats them as removed and tries to delete them.

Your module endpoints still point to those entries through their Documentation parameter, so the store blocks the delete.

That blocked delete is the foreign key error in your log.

Because the delete is blocked, your documentation entries stay in place, which matches what you saw.

PowerShell Universal 2026.3.4, now available, changes this behavior.

A repository reload now leaves resources that belong to a module alone, and each module reload manages its own resources.

In the release notes, this fix is listed as "Fixed external modules disappearing after Git synchronization changes": https://devolutions.net/powershell-universal/release-notes/

The same change also covers manual reloads such as Reload All Configurations.

Could you upgrade your dev machine to 2026.3.4 and run Reload All Configurations again?

Please let me know whether the error is gone.

If it still appears, send me the new log entry and I will reproduce it on our side with your sample module.

Until then, the error does not remove anything, so you can leave it as is.

A restart remains the cleanest way to pick up module changes on 2026.3.3.

Endpoint documentation is described here: https://docs.devolutions.net/powershell-universal/api/openapi

Best regards,

Patrick Ouimet

avatar

Hi Patrick,

Thank you for your clear explanation! After updating to 2026.3.4 the error is gone!

Kind Regards,

Romano