Setting local to global mapping for SNES FAS

I’m testing out SNES FAS and I am unclear how the errors can be resolved.
I added snes.setType('fas') below this line dolfinx/python/test/unit/fem/test_petsc_nonlinear_assembler.py at main · FEniCS/dolfinx · GitHub and ran the test. I get the error trace below.

../../../../miniforge3/envs/fea-env/lib/python3.12/site-packages/dolfinx/fem/petsc.py:624: in _assemble_matrix_block_mat
    Asub = A.getLocalSubMatrix(is_rows[i], is_cols[j])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   petsc4py.PETSc.Error: error code 73
E   [0] SNESSolve() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/interface/snes.c:4841
E   [0] SNESSolve_FAS() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/impls/fas/fas.c:870
E   [0] SNESFASCycle_Multiplicative() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/impls/fas/fas.c:713
E   [0] SNESFASDownSmooth_Private() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/impls/fas/fas.c:362
E   [0] SNESSolve() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/interface/snes.c:4841
E   [0] SNESSolve_NEWTONLS() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/impls/ls/ls.c:218
E   [0] SNESComputeJacobian() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/snes/interface/snes.c:2966
E   [0] MatGetLocalSubMatrix() at /home/conda/feedstock_root/build_artifacts/petsc_1727967184032/work/src/mat/interface/matrix.c:10700
E   [0] Object is in wrong state
E   [0] Matrix must have local to global mapping provided before this call

petsc4py/PETSc/Mat.pyx:4026: Error
================================================================== short test summary info ===================================================================
FAILED unit/fem/test_petsc_nonlinear_assembler.py::TestNLSPETSc::test_assembly_solve_block_nl - petsc4py.PETSc.Error: error code 73

How/where do I provide this information?

That error looks odd to me.

We do set the requested local to global mapping

I’d be leaning toward stating that this might be a bug in PETSc.
For instance, can it be possible that for the FAS type somehow calling

clears out not only the values, but also the mappings?
A simple test you could do would be to try to comment out that line (of course then you’ll get non convergence, because the matrix values get accumulated across the nonlinear iterations, but at least it would be useful to check if you still get the same error).