Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Stop translating agent-facing error prose (#85299)

Chris Vandoodewaardd94210f626cf
diff --git a/src/metabase/agent_lib/representations/repair.clj b/src/metabase/agent_lib/representations/repair.clj
index 2c6d61c6280..5df978cfd57 100644
--- a/src/metabase/agent_lib/representations/repair.clj
+++ b/src/metabase/agent_lib/representations/repair.clj
@@ -44,7 +44,6 @@
[metabase.models.serialization.resolve.mp :as resolve.mp]
[metabase.util :as u]
[metabase.util.date-2 :as u.date]
- [metabase.util.i18n :refer [tru]]
[metabase.util.log :as log]
[metabase.util.malli.registry :as mr]
[metabase.util.match :as match]
@@ -1851,8 +1850,8 @@
(and inferred-type (not (contains? opts "effective-type")))
(assoc "effective-type" inferred-type))]
["aggregation" new-opts uuid])
- (throw (ex-info (tru "Aggregation index {0} out of range; stage has {1} aggregation(s): {2}"
- idx (count index->uuid) (agg-heads-summary aggs-for-error))
+ (throw (ex-info (format "Aggregation index %s out of range; stage has %s aggregation(s): %s"
+ idx (count index->uuid) (agg-heads-summary aggs-for-error))
{:agent-error? true
:error :aggregation-ref-out-of-range
:index idx
@@ -1884,7 +1883,7 @@
;; Integer ref(s) present but stage has no aggregation vector - agent-error.
(not (and (vector? aggs) (seq aggs)))
- (throw (ex-info (tru "Found an integer-indexed aggregation reference but this stage has no `aggregation:` clause")
+ (throw (ex-info "Found an integer-indexed aggregation reference but this stage has no `aggregation:` clause"
{:agent-error? true
:error :aggregation-ref-no-aggregations}))
@@ -2101,7 +2100,7 @@
(some? clause)))
(map stage ["order-by" "limit" "fields"]))
(throw (ex-info
- (tru "Detected a post-aggregation filter alongside `order-by:`, `limit:`, or `fields:` in the same stage. MBQL 5 requires the filter in a separate stage, but those trailing clauses cannot be safely relocated — they may reference pre-aggregation columns that don''t survive the split. Please author this as two stages explicitly: stage 0 with `source-table`, `aggregation`, `breakout`, and any pre-aggregation `filters`; stage 1 with the post-aggregation `filters`, plus `order-by` / `limit` / `fields` that reference the aggregation''s output via cross-stage `[\"field\", (empty opts), \"<column-name>\"]` refs.")
+ "Detected a post-aggregation filter alongside `order-by:`, `limit:`, or `fields:` in the same stage. MBQL 5 requires the filter in a separate stage, but those trailing clauses cannot be safely relocated — they may reference pre-aggregation columns that don't survive the split. Please author this as two stages explicitly: stage 0 with `source-table`, `aggregation`, `breakout`, and any pre-aggregation `filters`; stage 1 with the post-aggregation `filters`, plus `order-by` / `limit` / `fields` that reference the aggregation's output via cross-stage `[\"field\", (empty opts), \"<column-name>\"]` refs."
{:agent-error? true
:status-code 400
:error-code :post-agg-filter-with-trailing-clauses
@@ -2120,7 +2119,7 @@
"filters" moved-filters}]
[s0 s1])
(throw (ex-info
- (tru "Detected a post-aggregation filter (a filter referencing an aggregation from the same stage). MBQL 5 requires this in a separate stage. Auto-fix is unsafe here — either an aggregation''s output column name cannot be derived (e.g. a `metric` reference or unknown head), or two aggregations in this stage would produce the same column name (e.g. two `sum` aggregations on different fields, which lib disambiguates as `sum` / `sum_2` based on field order). Please refactor to multi-stage manually: put the aggregations in stage 0, and the filter in stage 1 referencing the column via a cross-stage `[\"field\", (empty opts), \"<column-name>\"]` clause. Use an explicit aggregation with a `name` opts override (e.g. `[\"sum\", (opts with key \"name\" → \"sum_total\"), …]`) if you need stable cross-stage names.")
+ "Detected a post-aggregation filter (a filter referencing an aggregation from the same stage). MBQL 5 requires this in a separate stage. Auto-fix is unsafe here — either an aggregation's output column name cannot be derived (e.g. a `metric` reference or unknown head), or two aggregations in this stage would produce the same column name (e.g. two `sum` aggregations on different fields, which lib disambiguates as `sum` / `sum_2` based on field order). Please refactor to multi-stage manually: put the aggregations in stage 0, and the filter in stage 1 referencing the column via a cross-stage `[\"field\", (empty opts), \"<column-name>\"]` clause. Use an explicit aggregation with a `name` opts override (e.g. `[\"sum\", (opts with key \"name\" → \"sum_total\"), …]`) if you need stable cross-stage names."
{:agent-error? true
:status-code 400
:error-code :post-agg-filter-needs-multi-stage
@@ -2605,10 +2604,10 @@
;; so listing them in the diagnostic is fine. The FK column portables are NOT
;; surfaced here — see the rationale on `:ambiguous-fk` above.
(let [aliases (mapv :alias cands)]
- (throw (ex-info (tru "Field {0} is reachable from {1} explicit joins via aliases {2}. Specify the `source-field-join-alias` option on the field clause to pick which join''s foreign key to use."
- (display-portable fk)
- (count cands)
- (str/join ", " (map pr-str aliases)))
+ (throw (ex-info (format "Field %s is reachable from %s explicit joins via aliases %s. Specify the `source-field-join-alias` option on the field clause to pick which join's foreign key to use."
+ (display-portable fk)
+ (count cands)
+ (str/join ", " (map pr-str aliases)))
{:status-code 400
:error :ambiguous-fk-via-join
:agent-error? true
@@ -3013,13 +3012,13 @@
(defn- unresolved-join-alias-fields-error
[problems]
(ex-info
- (tru "Some join column references name a column their join doesn''t return: {0}. Reference a join column by its machine name (e.g. an aggregation is `min`, `count`, `sum` - never its display label like `Min of X`), and only columns the join returns: a grouped join returns just its breakouts and aggregations."
- (str/join "; " (for [{:keys [stage join-alias columns available]} problems]
- (tru "stage {0}, join {1} doesn''t return {2} (available: {3})"
- stage
- (quoting/quoted join-alias)
- (str/join ", " (map quoting/quoted columns))
- (str/join ", " (map quoting/quoted available))))))
+ (format "Some join column references name a column their join doesn't return: %s. Reference a join column by its machine name (e.g. an aggregation is `min`, `count`, `sum` - never its display label like `Min of X`), and only columns the join returns: a grouped join returns just its breakouts and aggregations."
+ (str/join "; " (for [{:keys [stage join-alias columns available]} problems]
+ (format "stage %s, join %s doesn't return %s (available: %s)"
+ stage
+ (quoting/quoted join-alias)
+ (str/join ", " (map quoting/quoted columns))
+ (str/join ", " (map quoting/quoted available))))))
{:agent-error? true
:error :unresolved-join-alias-field
:problems problems}))
@@ -3120,9 +3119,9 @@
(pos? idx) (mini-resolved-columns mp query idx content-store))]
(when-let [bad (first-unresolved-cross-stage-ref stage cols)]
(throw (ex-info
- (tru "No column named {0} is available to reference in this stage. Reference a column by its machine name (e.g. an aggregation is `max`, `count`, `sum` - never its display label like `Max of X`), not a UI label. Available column names: {1}."
- (quoting/quoted (nth bad 2))
- (str/join ", " (map (comp quoting/quoted :name) cols)))
+ (format "No column named %s is available to reference in this stage. Reference a column by its machine name (e.g. an aggregation is `max`, `count`, `sum` - never its display label like `Max of X`), not a UI label. Available column names: %s."
+ (quoting/quoted (nth bad 2))
+ (str/join ", " (map (comp quoting/quoted :name) cols)))
{:agent-error? true
:error :unresolved-cross-stage-field
:stage idx
@@ -3169,8 +3168,8 @@
(>= (count entry) 1)
(= "field" (nth entry 0)))
(throw (ex-info
- (tru "Stage {0} aggregation entry {1} is a `field` clause, not an aggregation. The `aggregation:` block expects aggregation functions like `count`, `sum`, `avg`, `metric`, etc. - or wrap the field in one (e.g. `[sum, <opts>, <field>]`). If you wanted to group by this column, use `breakout:` instead."
- stage-idx entry-idx)
+ (format "Stage %s aggregation entry %s is a `field` clause, not an aggregation. The `aggregation:` block expects aggregation functions like `count`, `sum`, `avg`, `metric`, etc. - or wrap the field in one (e.g. `[sum, <opts>, <field>]`). If you wanted to group by this column, use `breakout:` instead."
+ stage-idx entry-idx)
{:agent-error? true
:error :aggregation-entry-not-aggregation
:stage-index stage-idx
@@ -3195,7 +3194,7 @@
(match/match-one form
[#{"case" "if"} {"default" _} & _]
(throw (ex-info
- (tru "`case` (and `if`) uses its third positional argument as the fallback value, not a `default` key in the options map. Move the value out of the options map and append it as the third arg of the clause: `[case, <opts>, <branch-pairs>, <default>]`. Omit the third arg entirely if you have no fallback (the result will be null on miss).")
+ "`case` (and `if`) uses its third positional argument as the fallback value, not a `default` key in the options map. Move the value out of the options map and append it as the third arg of the clause: `[case, <opts>, <branch-pairs>, <default>]`. Omit the third arg entirely if you have no fallback (the result will be null on miss)."
{:agent-error? true
:error :case-default-in-opts
:clause &match}))))
@@ -3226,8 +3225,8 @@
(match/match-one form
[(head :guard sexp-legacy-top-level-ops) & _]
(throw (ex-info
- (tru "`{0}` is not a clause in repr; it was a top-level operation in the older sexp pipeline. {1}"
- head (get sexp-legacy-top-level-ops head))
+ (format "`%s` is not a clause in repr; it was a top-level operation in the older sexp pipeline. %s"
+ head (get sexp-legacy-top-level-ops head))
{:agent-error? true
:error :sexp-legacy-op-as-clause
:head head
@@ -3247,7 +3246,7 @@
(match/match-one form
["expression" #'map? (name-slot :guard (or (not (string? name-slot)) (str/blank? name-slot)))]
(throw (ex-info
- (tru "`[expression, <opts>, <name>]` reference requires a non-blank string identifier in the third slot, matching an entry in some stage''s `expressions:` block.")
+ "`[expression, <opts>, <name>]` reference requires a non-blank string identifier in the third slot, matching an entry in some stage's `expressions:` block."
{:agent-error? true
:error :blank-expression-ref
:clause &match}))))
@@ -3270,7 +3269,7 @@
(match/match-one form
["field" #'map? #'integer?]
(throw (ex-info
- (tru "`field` clause needs a portable FK in its third slot, not a numeric id. Use a vector `[<database>, <schema>, <table>, <column>]` (resolved against the metadata provider) or a string column-name (for cross-stage references).")
+ "`field` clause needs a portable FK in its third slot, not a numeric id. Use a vector `[<database>, <schema>, <table>, <column>]` (resolved against the metadata provider) or a string column-name (for cross-stage references)."
{:agent-error? true
:error :numeric-field-id
:clause &match})))))
@@ -3342,8 +3341,8 @@
(some? (get (nth node 1) "unit")))
false))
(throw (ex-info
- (tru "Move the temporal unit in `{0}` off the literal. Write a range with `>=` the first day of the period and `<` the first day after the period, both as plain date strings (not `between`, which drops everything after midnight on its last day). To exclude `2025-01-31`, use an `or` of `< \"2025-01-31\"` and `>= \"2025-02-01\"` on the column. These comparisons drop rows with no date; add `is-null` on the column to the `or` if they should count. Join `conditions:` cannot hold an `or`, so a date exclusion cannot be written there; tell the user that it cannot be added to the join. You can instead put the unit on the column with `temporal-unit` in `filters:` and `expressions:`, then compare the column to the first day of the period as a plain date string. Do not put the unit on the column in `aggregation:` or join `conditions:`, where the query engine does not turn it into a range. Use the range for `year` on an `expression` reference, which the query engine reads as a number."
- (pr-str node))
+ (format "Move the temporal unit in `%s` off the literal. Write a range with `>=` the first day of the period and `<` the first day after the period, both as plain date strings (not `between`, which drops everything after midnight on its last day). To exclude `2025-01-31`, use an `or` of `< \"2025-01-31\"` and `>= \"2025-02-01\"` on the column. These comparisons drop rows with no date; add `is-null` on the column to the `or` if they should count. Join `conditions:` cannot hold an `or`, so a date exclusion cannot be written there; tell the user that it cannot be added to the join. You can instead put the unit on the column with `temporal-unit` in `filters:` and `expressions:`, then compare the column to the first day of the period as a plain date string. Do not put the unit on the column in `aggregation:` or join `conditions:`, where the query engine does not turn it into a range. Use the range for `year` on an `expression` reference, which the query engine reads as a number."
+ (pr-str node))
{:agent-error? true
:error :unencodable-temporal-clause
:clause node})))
@@ -3547,8 +3546,8 @@
:aggregation "`aggregation:`"
:filter "`filters:`")]
(throw (ex-info
- (tru "The query builder''s expression editor rejects a {0} clause in stage {1}: {2}. The query would build but could not be visualized or saved - rewrite the offending clause."
- where original-idx (str/replace message #"\.$" ""))
+ (format "The query builder's expression editor rejects a %s clause in stage %s: %s. The query would build but could not be visualized or saved - rewrite the offending clause."
+ where original-idx (str/replace message #"\.$" ""))
{:agent-error? true
:error :expression-editor-rejection
:status-code 400
@@ -3605,10 +3604,10 @@
type-name (name column-type)
unit-name (name temporal-unit)]
(throw (ex-info (if (= :expression (nth clause 0))
- (tru "{0} is a {1} custom column, so it cannot be bucketed by {2}. Compare it to a plain value, or bucket a date / datetime column instead."
- column-name type-name unit-name)
- (tru "{0} is a {1} column, so it cannot be bucketed by {2}. Compare it to a plain value, or bucket a date / datetime column instead."
- column-name type-name unit-name))
+ (format "%s is a %s custom column, so it cannot be bucketed by %s. Compare it to a plain value, or bucket a date / datetime column instead."
+ column-name type-name unit-name)
+ (format "%s is a %s column, so it cannot be bucketed by %s. Compare it to a plain value, or bucket a date / datetime column instead."
+ column-name type-name unit-name))
{:agent-error? true
:error :temporal-unit-on-non-temporal-column
:status-code 400
diff --git a/src/metabase/metabot/tools/construct.clj b/src/metabase/metabot/tools/construct.clj
index a739a5e9404..a0ec40341f9 100644
--- a/src/metabase/metabot/tools/construct.clj
+++ b/src/metabase/metabot/tools/construct.clj
@@ -35,7 +35,6 @@
[metabase.models.serialization.resolve.mp :as resolve.mp]
[metabase.query-processor.core :as qp]
[metabase.util :as u]
- [metabase.util.i18n :refer [tru]]
[metabase.util.json :as json]
[metabase.util.malli :as mu]
[metabase.util.malli.registry :as mr]
@@ -193,7 +192,7 @@
(let [raw (get-in parsed-query ["stages" 0 "source-table"])]
(when (string? raw)
(when-let [[_ entity-type entity-id] (re-find metabase-uri-source-table-pattern raw)]
- (throw (ex-info (tru "`source-table:` does not accept URIs like `{0}`." raw)
+ (throw (ex-info (format "`source-table:` does not accept URIs like `%s`." raw)
{:agent-error? true
:status-code 400
:error :uri-in-source-table
@@ -458,7 +457,7 @@
(cond
(pos-int? ref)
(when-not (visible-table metadata-provider ref)
- (throw (ex-info (tru "No table found with id {0}." (str ref))
+ (throw (ex-info (format "No table found with id %s." (str ref))
{:agent-error? true
:status-code 400
:error :unknown-table-id
@@ -467,7 +466,7 @@
(and (vector? ref) (= ::field-id (nth ref 0 nil)))
(let [field-id (nth ref 1)]
(when-not (visible-field metadata-provider field-id)
- (throw (ex-info (tru "No field found with id {0}." (str field-id))
+ (throw (ex-info (format "No field found with id %s." (str field-id))
{:agent-error? true
:status-code 400
:error :unknown-field-id
@@ -477,8 +476,8 @@
(let [[_ model id] ref]
(when-not (resolve-table-fk metadata-provider nil ref)
(throw (ex-info (if (= model :model/Measure)
- (tru "No measure found with id {0}." (str id))
- (tru "No segment found with id {0}." (str id)))
+ (format "No measure found with id %s." (str id))
+ (format "No segment found with id %s." (str id)))
{:agent-error? true
:status-code 400
:error (if (= model :model/Measure)
@@ -514,7 +513,7 @@
(api/query-check :model/Table table-id)
(catch clojure.lang.ExceptionInfo e
(if (= 403 (:status-code (ex-data e)))
- (throw (ex-info (tru "No table found with id {0}." (str table-id))
+ (throw (ex-info (format "No table found with id %s." (str table-id))
{:agent-error? true
:status-code 400
:error :unknown-table-id
@@ -575,14 +574,14 @@
(let [db-name (nth source-table-fk 0)
ids (metabot.db/database-ids-by-name db-name)]
(case (count ids)
- 0 (throw (ex-info (tru "Unknown database: `{0}`." db-name)
+ 0 (throw (ex-info (format "Unknown database: `%s`." db-name)
{:agent-error? true
:status-code 400
:error :unknown-database
:database db-name}))
1 (first ids)
- (throw (ex-info (tru "Multiple databases share the name `{0}` (ids: {1})."
- db-name (pr-str (vec (sort ids))))
+ (throw (ex-info (format "Multiple databases share the name `%s` (ids: %s)."
+ db-name (pr-str (vec (sort ids))))
{:agent-error? true
:status-code 400
:error :ambiguous-database-name
@@ -595,12 +594,10 @@
;; decides which provider to build), so an unchecked existence answer here would let the
;; id argument enumerate table ids across databases the caller cannot otherwise see.
(or (metabot.db/readable-active-table-database-id numeric-table)
- ;; the id renders via str, not as a number — tru's MessageFormat would add locale
- ;; digit grouping ("999,999,999").
;; `:unknown-table-id`, not `:unknown-table`: a portable-FK miss (`:unknown-table`)
;; recovers by naming a portable FK, which is wrong advice for a numeric-id caller.
- (throw (ex-info (tru "No table found with id {0}."
- (str numeric-table))
+ (throw (ex-info (format "No table found with id %s."
+ (str numeric-table))
{:agent-error? true
:status-code 400
:error :unknown-table-id
@@ -609,7 +606,7 @@
source-card-eid
(if-let [card (tools.u/get-card-by-entity-id source-card-eid)]
(:database_id card)
- (throw (ex-info (tru "No saved question or model found with entity_id {0}." (pr-str source-card-eid))
+ (throw (ex-info (format "No saved question or model found with entity_id %s." (pr-str source-card-eid))
{:agent-error? true
:status-code 400
:error :unknown-card
@@ -631,8 +628,8 @@
false
(throw e)))))]
(when-not readable
- (throw (ex-info (tru "No saved question or model found with id {0}."
- (str card-id))
+ (throw (ex-info (format "No saved question or model found with id %s."
+ (str card-id))
{:agent-error? true
:status-code 400
;; the numeric-specific key, matching `export-card-by-id` — a numeric
@@ -642,7 +639,7 @@
(:database_id card))
:else
- (throw (ex-info (tru "First stage must have either `source-table:` or `source-card:`; neither was found in `stages[0]`.")
+ (throw (ex-info "First stage must have either `source-table:` or `source-card:`; neither was found in `stages[0]`."
{:agent-error? true
:status-code 400
:error :missing-source-in-first-stage})))))
@@ -850,17 +847,17 @@
;; normalization stamps `:lib/uuid` on every clause; one missing means normalizing a clause
;; inside it failed, often because it references something that doesn't exist
(= :lib/uuid missing)
- (tru "a reference inside it could not be resolved - often a field reference to a column, join alias, or expression that does not exist. Refer to a join''s or an earlier stage''s columns by their exact machine name (an aggregation is `min`, `count`, `sum`)")
+ "a reference inside it could not be resolved - often a field reference to a column, join alias, or expression that does not exist. Refer to a join's or an earlier stage's columns by their exact machine name (an aggregation is `min`, `count`, `sum`)"
(= :base-type missing)
- (tru "a field reference by name is missing `base-type`, usually because the name matches no real column")
+ "a field reference by name is missing `base-type`, usually because the name matches no real column"
missing
- (tru "missing `{0}`" (name missing))
+ (format "missing `%s`" (name missing))
;; the message of `::lib.schema.expression/expression.definition`'s aggregation check
(= "non-aggregation expression" (me/error-message error))
- (tru "{0}: aggregation and window functions such as `offset` cannot be custom columns - move them to `aggregation:` or `order-by:`" (me/error-message error)))))
+ (format "%s: aggregation and window functions such as `offset` cannot be custom columns - move them to `aggregation:` or `order-by:`" (me/error-message error)))))
(defn- query-not-runnable-explanation
"Explain why `pmbql-query` fails the query builder's `canRun` check, or return nil.
@@ -879,9 +876,9 @@
(take 3)
seq
(str/join "; "))
- (tru "the query does not match the query builder''s schema"))
+ "the query does not match the query builder's schema")
(not-any? not-runnable-problem errors)
- (str ". " (tru "This usually means a field reference is missing its type or names a column that does not exist, or an aggregation or window function such as `offset` is in `expressions:` instead of `aggregation:` or `order-by:`"))))))))
+ (str ". This usually means a field reference is missing its type or names a column that does not exist, or an aggregation or window function such as `offset` is in `expressions:` instead of `aggregation:` or `order-by:`")))))))
(defn- incompatible-metrics
"Return the required sources of incompatible metrics in the first stage, sorted by metric ID.
@@ -1050,8 +1047,8 @@
_validated (repr/validate-query repaired)
pmbql-query (repr.resolve/resolve-query mp repaired permission-aware-content-store)
_runnable (when-let [why (query-not-runnable-explanation pmbql-query repaired)]
- (throw (ex-info (tru "The constructed query is not runnable - it would fail the query builder''s validation, so it cannot be visualized or saved. Failing paths: {0}."
- why)
+ (throw (ex-info (format "The constructed query is not runnable - it would fail the query builder's validation, so it cannot be visualized or saved. Failing paths: %s."
+ why)
{:agent-error? true
:error :query-not-runnable
:status-code 400})))
diff --git a/src/metabase/metabot/tools/recovery_hints.clj b/src/metabase/metabot/tools/recovery_hints.clj
index 2e700023e61..ef1ef2fa5b8 100644
--- a/src/metabase/metabot/tools/recovery_hints.clj
+++ b/src/metabase/metabot/tools/recovery_hints.clj
@@ -12,8 +12,7 @@
which is the intended failure mode: a missing hint reads as terse, a wrong one sends the
agent at a tool it does not have."
(:require
- [metabase.agent-lib.representations :as repr]
- [metabase.util.i18n :refer [tru]]))
+ [metabase.agent-lib.representations :as repr]))
(set! *warn-on-reflection* true)
@@ -29,13 +28,13 @@
"`aggregation: [[metric, {}, \"<portable_entity_id>\"]]`.")
("question" "model" "card")
- (tru "To reference a saved question or model as a query source, put its `portable_entity_id` (the 21-char string from its search result or `read_resource`) into `source-card:` — not a URI.")
+ "To reference a saved question or model as a query source, put its `portable_entity_id` (the 21-char string from its search result or `read_resource`) into `source-card:` — not a URI."
"table"
- (tru "Use the portable FK `[<db-name>, <schema>, <table-name>]` in `source-table:` — not a URI. `read_resource metabase://table/{0}` reports the exact names."
- (str entity-id))
+ (format "Use the portable FK `[<db-name>, <schema>, <table-name>]` in `source-table:` — not a URI. `read_resource metabase://table/%s` reports the exact names."
+ (str entity-id))
- (tru "`source-table:` accepts a portable FK `[<db-name>, <schema>, <table-name>]` or, via `source-card:`, a saved-card `portable_entity_id`.")))
+ "`source-table:` accepts a portable FK `[<db-name>, <schema>, <table-name>]` or, via `source-card:`, a saved-card `portable_entity_id`."))
(defn- card-fields-hint
"Return guidance for listing `what` from the source card, or nil when `data` names no card."
@@ -49,7 +48,7 @@
[humanized]
(let [paths (repr/humanized->paths humanized)]
(when (seq paths)
- (tru "Invalid at {0}. Fix the named paths." paths))))
+ (format "Invalid at %s. Fix the named paths." paths))))
(defn recovery-hint
"The v1 recovery sentence for an agent error's `ex-data`, or nil when it has none."
@@ -62,52 +61,52 @@
(uri-hint entity-type entity-id)
:unknown-table
- (tru "Call `read_resource` with `metabase://database/<numeric id>/tables` to list available tables and schemas, then retry with an exact portable FK from the response.")
+ "Call `read_resource` with `metabase://database/<numeric id>/tables` to list available tables and schemas, then retry with an exact portable FK from the response."
:unknown-table-id
;; A numeric-id miss, not a portable-FK miss: pointing the agent at a portable FK (as
;; `:unknown-table` does) would be wrong advice. v1 authors portable FKs, so the right move
;; is to find the table by name and use its portable FK.
- (tru "That numeric table id does not resolve. Call `read_resource` with `metabase://database/<numeric id>/tables` to find the table, then use its portable FK `[<db-name>, <schema>, <table-name>]` in `source-table:`.")
+ "That numeric table id does not resolve. Call `read_resource` with `metabase://database/<numeric id>/tables` to find the table, then use its portable FK `[<db-name>, <schema>, <table-name>]` in `source-table:`."
:ambiguous-table
- (tru "Call `read_resource` with `metabase://database/<numeric id>/tables` to list available tables and retry with a more specific portable FK.")
+ "Call `read_resource` with `metabase://database/<numeric id>/tables` to list available tables and retry with a more specific portable FK."
(:unknown-field :unknown-field-id)
- (tru "Call `read_resource` with `metabase://table/<numeric id>/fields` to list this table''s columns.")
+ "Call `read_resource` with `metabase://table/<numeric id>/fields` to list this table's columns."
:ambiguous-field
- (tru "The field name matches more than one column in this table, so it cannot be referenced by name. Tell the user about the ambiguous column name.")
+ "The field name matches more than one column in this table, so it cannot be referenced by name. Tell the user about the ambiguous column name."
:ambiguous-fk
(or (card-fields-hint data "foreign-key columns")
- (tru "Call `read_resource` with `metabase://table/<numeric id>/fields` for the source table to list the available foreign-key columns."))
+ "Call `read_resource` with `metabase://table/<numeric id>/fields` for the source table to list the available foreign-key columns.")
(:column-not-returned :unexportable-fk)
(card-fields-hint data "columns")
:no-fk-path
- (tru "If a metric relates to that table, read its dimensions resource `metabase://metric/<metric_id>/dimensions`, which lists the exact `joins:` clause to paste and the columns it unlocks.")
+ "If a metric relates to that table, read its dimensions resource `metabase://metric/<metric_id>/dimensions`, which lists the exact `joins:` clause to paste and the columns it unlocks."
(:unknown-card :unknown-card-id)
- (tru "Do not invent or guess entity_ids: call `read_resource` with `metabase://question/<numeric id>` or `metabase://model/<numeric id>` first, then copy the exact `portable_entity_id` from the response into `source-card:`.")
+ "Do not invent or guess entity_ids: call `read_resource` with `metabase://question/<numeric id>` or `metabase://model/<numeric id>` first, then copy the exact `portable_entity_id` from the response into `source-card:`."
(:unknown-measure :unknown-measure-id)
- (tru "Do not invent or guess entity_ids: read the table that owns the measure with `read_resource` (`metabase://table/<numeric id>`) and copy the exact `portable_entity_id` from its `<measure>` tag.")
+ "Do not invent or guess entity_ids: read the table that owns the measure with `read_resource` (`metabase://table/<numeric id>`) and copy the exact `portable_entity_id` from its `<measure>` tag."
(:unknown-segment :unknown-segment-id)
- (tru "Do not invent or guess entity_ids: read the table that owns the segment with `read_resource` (`metabase://table/<numeric id>`) and copy the exact `portable_entity_id` from its `<segment>` tag.")
+ "Do not invent or guess entity_ids: read the table that owns the segment with `read_resource` (`metabase://table/<numeric id>`) and copy the exact `portable_entity_id` from its `<segment>` tag."
(:cross-database-card :cross-database-measure :cross-database-segment)
- (tru "A query can only reference saved questions, models, metrics, measures and segments from its own database. Use one from that database, or change the source to a table in the referenced item''s database.")
+ "A query can only reference saved questions, models, metrics, measures and segments from its own database. Use one from that database, or change the source to a table in the referenced item's database."
:unknown-database
- (tru "Use the exact database name as reported by search / `read_resource` (it appears as the first element of every portable FK, e.g. `source-table: [<db-name>, <schema>, <table>]`).")
+ "Use the exact database name as reported by search / `read_resource` (it appears as the first element of every portable FK, e.g. `source-table: [<db-name>, <schema>, <table>]`)."
:ambiguous-database-name
- (tru "Ask the user to rename one of the databases.")
+ "Ask the user to rename one of the databases."
:missing-source-in-first-stage
- (tru "`source-table:` takes a portable FK `[<db-name>, <schema>, <table>]`; `source-card:` takes an entity_id string.")
+ "`source-table:` takes a portable FK `[<db-name>, <schema>, <table>]`; `source-card:` takes an entity_id string."
nil))