[PARTIALLY_SOLVED] CLI v7.10 Broken Sync


I’m submitting a…

  • [x] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

After upgrading the CLI from v7.4 to v7.10 to fix the singleton sync error here, sq sync in folder has broken. When running sq sync from a fresh data dump, it now throws errors like:

ArrayItemNotValid: #/assets[50]
  StringExpected: #/assets[50].folderPath
, Line: 1010, Col: 5
ERROR: Newtonsoft.Json.JsonException: Error reading file .../assets/6.json

Looking in the relevant JSON schema we have:

    "folderPath": {
      "type": [

It is complaining about lines such as

  "folderPath": null

But this should be fine as we declared it as possibly null in the schema.

Expected behavior

sq sync should work in CLI v7.10 like it did in v7.4.

Minimal reproduction of the problem

Version: CLI v7.10
sq sync


I cannot fix the actual problem, because it depends on the library: https://github.com/RicoSuter/NJsonSchema/pull/872

But I have made a fix to omit null values when writing files.

Thanks for the quick response, unfortunately I am still getting the same error with the new CLI.

Squidex CLI v7.11.0.0, API Compatibility >= 4.X

Yes, you have to delete the null values. I was not able to fix it without the support from the library.

The only fix I could make was not to write null values.

We have quite a lot of null values in various locations that would need deleting on every data import. Was the library introduced between v7.4 and v7.10? Because v7.4 has always worked fine.

No, the library was there from beginning. If you make an export the null values are not written.

Have done a fresh export and import with v7.11 - this seems to have fixed the above error (as well as the singleton sync errors from before). Unfortunately importing now throws:

* STEP 3 of 6: Importing contents started

ERROR: System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Squidex.CLI.Commands.Implementation.Sync.Contents.Extensions.ToJob(ContentModel model, SchemasDto schemas)
   at Squidex.CLI.Commands.Implementation.Sync.Contents.ContentsSynchronizer.<>c__DisplayClass7_0.<ImportAsync>b__2(ContentModel x)
   at System.Linq.Enumerable.SelectListIterator`2.ToList()
   at Squidex.CLI.Commands.Implementation.Sync.Contents.ContentsSynchronizer.ImportAsync(ISyncService sync, SyncOptions options, ISession session)
   at Squidex.CLI.Commands.Implementation.Sync.Synchronizer.<>c__DisplayClass5_0.<<ImportAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Squidex.CLI.Commands.Implementation.Extensions.Foreach[T](IEnumerable`1 source, Func`3 action)
   at Squidex.CLI.Commands.Implementation.Sync.Synchronizer.ImportAsync(String path, SyncOptions options, ISession session)
   at Squidex.CLI.Commands.App.Sync.In(InArguments arguments)
   at CommandDotNet.Execution.InvocationResultExtensions.GetResultCodeAsync(Object value)
   at CommandDotNet.AppRunner.HandleException(Exception ex, IConsole console, CommandContext commandContext)
   at CommandDotNet.AppRunner.Run(String[] args)
   at Squidex.CLI.Program.Main(String[] args)

I have fixed this, I hope.