Dashboard save failed error

Whenever i try to save changes to a specific dashboard, it refuses to save, giving out the message ‘Save Failed’
when i checked the logs this was the error message

{:via
 [{:type clojure.lang.ExceptionInfo,
   :message
   "ERROR: insert or update on table \"parameter_card\" violates foreign key constraint \"fk_parameter_card_ref_card_id\"\n  Detail: Key (card_id)=(975) is not present in table \"report_card\".",
   :data
   {:toucan2/context-trace
    [["execute SQL with class com.mchange.v2.c3p0.impl.NewProxyConnectionJdbc43Full"
      {:toucan2.jdbc.query/sql-args
       ["INSERT INTO \"parameter_card\" (\"parameterized_object_id\", \"parameterized_object_type\", \"parameter_id\", \"card_id\", \"updated_at\", \"created_at\") VALUES (?, ?, ?, ?, NOW(), NOW())"
        72
        "dashboard"
        "17170fd"
        975]}]
     ["resolve connection" {:toucan2.connection/connectable org.postgresql.jdbc.PgConnection}]
     ["resolve connection" {:toucan2.connection/connectable nil}]
     {:toucan2.pipeline/rf
      #object[clojure.core$completing$fn__8562 0x2550cab5 "clojure.core$completing$fn__8562@2550cab5"]}
     ["with compiled query"
      {:toucan2.pipeline/compiled-query
       ["INSERT INTO \"parameter_card\" (\"parameterized_object_id\", \"parameterized_object_type\", \"parameter_id\", \"card_id\", \"updated_at\", \"created_at\") VALUES (?, ?, ?, ?, NOW(), NOW())"
        72
        "dashboard"
        "17170fd"
        975]}]
     ["with built query"
      {:toucan2.pipeline/built-query
       {:insert-into [:parameter_card],
        :values
        ((toucan2.instance/instance
          :model/ParameterCard
          {:parameterized_object_id 72,
           :parameterized_object_type "dashboard",
           :parameter_id "17170fd",
           :card_id 975,
           :updated_at [:metabase.util.honey-sql-2/typed :%now {:database-type "timestamptz"}],
           :created_at [:metabase.util.honey-sql-2/typed :%now {:database-type "timestamptz"}]}))}}]
     ["resolve connection" {:toucan2.connection/connectable org.postgresql.jdbc.PgConnection}]
     ["resolve connection" {:toucan2.connection/connectable nil}]
     ["with resolved query" {:toucan2.pipeline/resolved-query {}}]
     ["with parsed args"
      {:toucan2.pipeline/query-type :toucan.query-type/insert.update-count,
       :toucan2.pipeline/parsed-args
       {:rows
        [{:parameterized_object_id 72,
          :parameterized_object_type "dashboard",
          :parameter_id "17170fd",
          :card_id 975}]}}]
     ["with model" {:toucan2.pipeline/model :model/ParameterCard}]
     ["with unparsed args"
      {:toucan2.pipeline/query-type :toucan.query-type/insert.update-count,
       :toucan2.pipeline/unparsed-args
       (:model/ParameterCard
        {:parameterized_object_id 72, :parameterized_object_type "dashboard", :parameter_id "17170fd", :card_id 975})}]
     ["execute SQL with class com.mchange.v2.c3p0.impl.NewProxyConnectionJdbc43Full"
      {:toucan2.jdbc.query/sql-args ["SELECT * FROM \"report_dashboard\" WHERE \"id\" = ?" 72]}]
     ["resolve connection" {:toucan2.connection/connectable org.postgresql.jdbc.PgConnection}]
     ["resolve connection" {:toucan2.connection/connectable nil}]
     {:toucan2.pipeline/rf
      #object[clojure.core$map$fn__5952$fn__5953 0x73bd08e2 "clojure.core$map$fn__5952$fn__5953@73bd08e2"]}
     ["with compiled query"
      {:toucan2.pipeline/compiled-query ["SELECT * FROM \"report_dashboard\" WHERE \"id\" = ?" 72]}]
     ["with built query"
      {:toucan2.pipeline/built-query {:select [:*], :from [[:report_dashboard]], :where [:= :id 72]}}]
     ["apply before-update to matching rows"
      {:toucan2.tools.before-update/model :model/Dashboard,
       :toucan2.tools.before-update/changes
       {:description nil,
        :archived false,
        :collection_position nil,
        :enable_embedding false,
        :collection_id 8,
        :show_in_getting_started false,
        :name "Dashboard 1 ",
        :width "full",
        :cache_ttl nil,
        :position nil,
        :archiv...

Also here is the diagnostic info:

{
  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0",
    "vendor": "Google Inc."
  },
  "metabase-info": {
    "databases": [
      "h2",
      "mysql"
    ],
    "run-mode": "prod",
    "plan-alias": "",
    "version": {
      "date": "2025-12-11",
      "tag": "v0.57.6",
      "hash": "e9e9771"
    },
    "settings": {
      "report-timezone": "Africa/Cairo"
    },
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "16.11"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.7.7"
      }
    }
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "21.0.7+6-Ubuntu-0ubuntu120.04",
    "java.vendor": "Ubuntu",
    "java.vendor.url": "https://ubuntu.com/",
    "java.version": "21.0.7",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "21.0.7+6-Ubuntu-0ubuntu120.04",
    "os.name": "Linux",
    "os.version": "5.4.0-216-generic",
    "user.language": "en",
    "user.timezone": "Etc/UTC"
  }
}

Just from the error message, one of the questions in the dashboard is missing from the app database.

Make sure someone else hasn’t been deleting questions used in the dashboard while you’ve been editing it. If they have, then that explains what happened to the missing question. You will need to reload the dashboard and discard your unsaved changes.

If that wasn’t it, we need to fix the dashboard. The brute force way is to rebuild the dashboard, or at least the tab with the broken card on it.

If you can query the app database, we can be more precise. Run this query to get the location of the broken dashboard card:

select * from v_dashboardcard where card_qualified_id='card_975';

The dashboard_qualified_id and dashboardtab_id fields will tell you what dashboard and what tab the bad card is on. You can access dashboards by ID by URL, i.e., https://your.metabase.install/dashboard/##.

Finally, I am assuming there is no app database corruption or someone restored a backup of it while you were editing. If there’s problems with the app database then those need to be fixed, and that is the subject of a different post.

No one is deleting anything. The question referenced in the error message does not exist. The URL redirects to a page displaying the following message: “We’re a little lost… The page you asked for couldn’t be found.”

The last time I encountered this issue, I resolved it by rebuilding the dashboard. However, since updating to version 0.57.6, this error has been occurring more frequently.

I will contact the application administrator to run the query, and I will follow up if they provide any useful information.