メインコンテンツまでスキップ

エラー一覧

GASsma で発生するエラークラスの一覧です。

エラーの捕捉

GASsma のエラークラスは Gassma 名前空間から公開されています。try / catch で捕捉し、instanceof でエラーの種類を判定できます。

try {
gassma.sheet1.findFirst({ take: 5 });
} catch (e) {
if (e instanceof Gassma.GassmaFindFirstTakeError) {
// findFirst の take が不正なときの処理
}
}

公開されているエラークラスは 51 個で、これに GassmaClient / GassmaController / FieldRef / skip を加えた 55 個が Gassma 名前空間の公開実体です。

注記

instanceof Date のようなビルトイン型の判定はライブラリ境界を越えると false になります(基本を参照)。一方、GASsma のエラークラスは Gassma 名前空間(ライブラリの global)経由で参照するため、instanceof で正しく判定できます。

検索・クエリ系

エラーメッセージ発生条件
GassmaFindSelectOmitConflictErrorCannot use both select and omit in the same queryselectomit を同時に指定
NotFoundErrorAn operation failed because it depends on one or more records that were required but not found.findFirstOrThrow でレコードが見つからない
GassmaSkipNegativeErrorInvalid value for skip argument: Value can only be positive, found: {value}skip有限の負数を指定(includeskip も同様)。NaN / Infinity / -Infinity / nullGassmaInvalidValueError になります
GassmaLimitNegativeErrorInvalid value for limit argument: Value can only be positive, found: {value}limit有限の負数を指定。NaN / Infinity / -Infinity / nullGassmaInvalidValueError になります
GassmaFindFirstTakeErrorThe 'findFirst' operation cannot be used with a 'take' argument that isn't 1 or -1findFirsttake1 / -1 以外を指定(NaN / Infinity / -Infinity を含む)。take: null のみ GassmaInvalidValueError になります

strictUndefinedChecks / Gassma.skip 系

詳しくは strictUndefinedChecks / Gassma.skip を参照してください。

エラーメッセージ発生条件
GassmaUndefinedValueErrorInvalid value for argument `{path}`: explicitly `undefined` values are not allowed.strictUndefinedChecks 有効時にクエリ入力へ明示的な undefined を指定。配列の要素(in / AND / OR / orderBy など)への undefined は有効・無効に関わらず発生
GassmaSkipInArrayErrorInvalid value for argument `{path}`: Can not use `Gassma.skip` value within array. Use `null` or filter out `Gassma.skip` values.配列の要素に Gassma.skip を指定(strictUndefinedChecks の有効・無効に関わらず発生)

orderBy 系

エラーメッセージ発生条件
RelationOrderByUnsupportedTypeErrorCannot use orderBy on "{relationName}" (type: {relationType}). Only manyToOne and oneToOne are supported.oneToMany / manyToMany のリレーションでフィールドソートを使用
RelationOrderByCountUnsupportedTypeErrorCannot use _count orderBy on "{relationName}" (type: {relationType}). Only oneToMany and manyToMany are supported.manyToOne / oneToOne のリレーションで _count ソートを使用

集計系

エラーメッセージ発生条件
GassmaAggregateMaxErrorCannot produce a maximum value of more than one type._max で異なる型が混在
GassmaAggregateMinErrorCannot produce a maximum value of more than one type._min で異なる型が混在
GassmaAggregateSumErrorCannot produce a maximum value of more than one type._sum で数値以外の型が混在
GassmaAggregateAvgErrorCannot produce a maximum value of more than one type._avg で数値以外の型が混在
GassmaAggregateTypeErrorOnly "number", "string", "boolean", and "Date" types are supported._max / _min でサポートされていない型
GassmaAggregateSumTypeErrorOnly "number" type is supported._sum で数値以外の型
GassmaAggregateAvgTypeErrorOnly "number" type is supported._avg で数値以外の型
GassmaAggregateSelectionRequiredErrorAt least one aggregation is required: specify `_avg`, `_count`, `_max`, `_min`, or `_sum` with at least one field.aggregate_avg / _count / _max / _min / _sum のいずれもフィールドを指定していない(where / orderBy / take だけの指定や、_count: {} のような空指定も含む)
注記

GassmaAggregateMinError / GassmaAggregateSumError / GassmaAggregateAvgErrorGassmaAggregateMaxError を継承しています。また GassmaAggregateAvgTypeErrorGassmaAggregateSumTypeError を継承しています。そのため、基底クラスで instanceof 判定すると派生クラスもまとめて捕捉できます。

groupBy 系

エラーメッセージ発生条件
GassmaGroupByHavingDontWriteByErrorWhen using "having" other than "_avg", "_count", "_max", "_min", and "_sum", column names can be used only if they are written in the "by" field.havingby に含まれないカラムを使用

設定系

エラーメッセージ発生条件
GassmaInValidColumnValueErrorstartColumnValue and endColumnValue can only use number, [a-z] and [A-Z].changeSettings に無効な列値を指定

引数系

エラーメッセージ発生条件
GassmaMissingArgumentErrorArgument `{argumentName}` is missing.必須引数(data / where / create / update / by など)を省略
GassmaUnknownArgumentErrorUnknown argument `{argumentName}`. Did you mean `{suggestion}`? Available: {availableArguments}クエリ入力に未知のキーを指定(トップレベル引数、where / data / select / omit / orderBy のカラム名、フィルタ演算子、increment などの更新演算子等)。GassmaClient のオプション(map / defaults / updatedAt / autoincrement / ignore / omit)が存在しないカラムを参照した場合も発生
GassmaInvalidValueErrorInvalid value for argument `{argumentName}`. Expected {expected}.引数の値が受け付けられない形。発生条件が多いため下記にまとめています
注記

GassmaUnknownArgumentError のメッセージのうち、Did you mean ...? は近い候補が見つかった場合のみ、Available: ... は候補一覧が空でない場合のみ含まれます。

GassmaInvalidValueError の発生条件

メッセージは常に Invalid value for argument `{argumentName}`. Expected {expected}. の形式です。以下の表では {expected} の部分を示します。

形が正しくない引数

条件{argumentName}{expected}
OR / AND / NOT に配列以外を指定OR などan array
orderBy の値が "asc" / "desc" でない(配列を渡した場合を含む)orderBy"asc" | "desc"
orderBysort"asc" / "desc" でないsort"asc" | "desc"
orderBynulls"first" / "last" でないnulls"first" | "last"
orderBy のリレーションキーにオブジェクト以外を指定リレーション名a relation orderBy object
select に選択するフィールドが 1 つもないselectat least one selected field
cursor にカラムが 1 つもないcursorat least one column
単一行操作(update / delete / upsert)の where に条件が 1 つもないwhereat least one condition

ページング(take / skip / limit)の異常値

{expected}
NaN / Infinity / -Infinitya finite number, but received NaN
nulla number, but received null

take / skipfindMany / findFirst / count / aggregate / groupBylimitupdateMany / updateManyAndReturn / deleteMany が対象です。undefined は従来どおり「指定しなかった」扱いで無視されます。

注記

findFirsttake1 / -1 の判定が先に行われるため、NaN / Infinity / -InfinityGassmaFindFirstTakeError になります(take: null のみ GassmaInvalidValueError)。include 内の take / skipIncludeInvalidOptionTypeError になります。

構造を期待する引数への null

{expected} は末尾に , but received null が付きます(例: Invalid value for argument `where`. Expected an object, but received null.)。

{argumentName}{expected}
where / cursor / having / some / every / none / createManyan object
data / create / update / connect / connectOrCreate / set / deleteMany / updateMany / AND / OR / NOTan object or an array
orderByan object or an array
distinct / bya field name or an array of field names
disconnect / deletea boolean or an object
contains / startsWith / endsWitha string
gt / gte / lt / ltea comparable value
increment / decrement / multiply / dividea number
cursor のカラムの値a scalar value

配列の要素に null を入れた場合も同じエラーになります(AND: [null] / distinct: [null] / createManydata: [null] など)。詳しくは null の扱いを参照してください。

セルに保存できない値

書き込み(data)およびクエリ(where / cursor / having)の値が対象です。

{expected}
NaN / Infinity / -Infinitya finite number, but received NaN
Invalid Datea valid Date, but the provided Date object is invalid
配列a scalar value, but received an array
関数a scalar value, but received a function
Symbola scalar value, but received a symbol
BigInta scalar value, but received a bigint
Map / Set / RegExp / Error / Promise などの組み込みオブジェクトa scalar value, but received a Map
クラスインスタンスなどのその他のオブジェクトa scalar value, but received an object
Gassma.rawwhere / cursor / having のみ)a scalar value, but received a Gassma.raw value

Date / Gassma.rawdata のみ)/ FieldRef はオブジェクトですが、そのまま渡せます。組み込みオブジェクトの名前の部分は値の内部種別がそのまま入ります(Set なら but received a Set.)。

数値演算の結果

increment / decrement / multiply / divide演算結果NaN / Infinity / -Infinity になる場合に発生します。{argumentName}カラム名です。

{expected}
a finite number, but received Infinity

詳しくは update()を参照してください。

リレーション定義系

エラーメッセージ発生条件
RelationSheetNotFoundErrorSheet "{sheetName}" is not found in the spreadsheetリレーション定義のシートが存在しない
RelationMissingPropertyErrorRelation "{relationName}" on sheet "{sheetName}" is missing required property "{property}"リレーション定義の必須プロパティが欠落
RelationInvalidPropertyTypeErrorRelation "{relationName}" on sheet "{sheetName}": property "{property}" must be a {expectedType}リレーション定義のプロパティの型が不正
RelationInvalidTypeErrorRelation "{relationName}" on sheet "{sheetName}": type "{value}" is not valid. Must be one of: oneToMany, oneToOne, manyToOne, manyToManyリレーションの type が無効
RelationColumnNotFoundErrorColumn "{columnName}" is not found in sheet "{sheetName}"リレーション定義の field / reference のカラムが存在しない
RelationInvalidOnDeleteErrorRelation "{relationName}" on sheet "{sheetName}": onDelete "{value}" is not valid. Must be one of: Cascade, SetNull, Restrict, NoActiononDelete の値が無効
RelationInvalidOnUpdateErrorRelation "{relationName}" on sheet "{sheetName}": onUpdate "{value}" is not valid. Must be one of: Cascade, SetNull, Restrict, NoActiononUpdate の値が無効
RelationIgnoredColumnErrorRelation "{relationName}" on sheet "{sheetName}": column "{columnName}" is ignored on sheet "{ignoredSheetName}". Ignored columns are stripped from where conditions, so relation processing (onDelete/onUpdate/nested writes) could modify all rows in sheet "{ignoredSheetName}". Remove "{columnName}" from the ignore option or remove this relationリレーションの field / reference(manyToMany では throughfield / reference も)が ignore 指定されたカラムを参照している(クライアント初期化時に検出)

リレーション操作系

エラーメッセージ発生条件
GassmaRelationNotFoundErrorRelation "{relationName}" is not defined for sheet "{sheetName}"include で未定義のリレーション名を指定
GassmaRelationDuplicateErrorDuplicate value "{value}" found in "{sheetName}.{field}" for a unique relationoneToOne / manyToOne でリレーション先に重複値が存在
GassmaThroughRequiredErrorRelation "{relationName}" is manyToMany but "through" is not definedmanyToMany で through(中間テーブル)が未定義
RelationOnDeleteRestrictErrorCannot delete: related records exist for relation "{relationName}" (onDelete: Restrict)onDelete: "Restrict" 設定時に関連レコードが存在する状態で削除
RelationOnUpdateRestrictErrorCannot update: related records exist for relation "{relationName}" (onUpdate: Restrict)onUpdate: "Restrict" 設定時に関連レコードが存在する状態で PK を更新

include 系

エラーメッセージ発生条件
IncludeWithoutRelationsErrorCannot use include without defining relations in GassmaClientリレーション定義なしで include を使用
GassmaIncludeSelectConflictErrorCannot use both include and select in the same queryトップレベルで includeselect を同時使用
IncludeInvalidOptionTypeErrorInclude "{relationName}": option "{option}" must be {expectedType}include のオプション値の型が不正。take / skipNaN / Infinity / -Infinity を指定すると must be a finite numbernull など数値以外を指定すると must be a number になります
IncludeSelectOmitConflictErrorInclude "{relationName}": cannot use both select and omit at the same timeinclude 内で selectomit を同時指定
IncludeSelectIncludeConflictErrorInclude "{relationName}": cannot use both select and include at the same timeinclude 内で selectinclude を同時指定

where リレーションフィルタ系

エラーメッセージ発生条件
WhereRelationInvalidFilterErrorFilter "{filterType}" cannot be used on relation "{relationName}" of type "{relationType}"リレーション型に不適切なフィルタを使用(例: oneToMany に is を使用)
WhereRelationWithoutContextErrorCannot use relation filters in where clause without defining relationsリレーション定義なしでリレーションフィルタを使用

Nested Write 系

エラーメッセージ発生条件
NestedWriteWithoutRelationsErrorCannot use nested write operations without defining relations in GassmaClientリレーション定義なしで Nested Write を使用
NestedWriteConnectNotFoundErrorNested write connect failed: no record found in "{sheetName}"connect / connectOrCreate で対象レコードが見つからない
NestedWriteRelationNotFoundErrorNested write failed: "{fieldName}" is not a defined relationNested Write で未定義のリレーション名を使用
NestedWriteInvalidOperationErrorNested write: operation "{operation}" is not valid for relation "{relationName}" of type "{relationType}"リレーション型に非対応の操作を使用(例: manyToMany に delete を使用)
NestedWriteTargetNotFoundErrorNested write {operation} failed: no record found in "{sheetName}"非FK側 oneToOne の nested update / delete でリレーション先レコードが存在しない

トランザクション系

詳しくは $transaction を参照してください。

エラーメッセージ発生条件
GassmaTransactionLockTimeoutErrorTransaction API error: Unable to start a transaction in the given time. The maxWait for this transaction was {maxWaitMs} ms.$transaction の開始時、maxWait 以内にスクリプトロックを取得できない
GassmaTransactionTimeoutErrorTransaction API error: A {phase} cannot be executed on an expired transaction. The timeout for this transaction was {timeoutMs} ms, however {elapsedMs} ms passed since the start of the transaction. Consider increasing the transaction timeout or doing less work in the transaction.トランザクション開始からの経過時間が timeout を超過(tx 操作の呼び出し時またはコミット直前に検知)
GassmaNestedTransactionErrorTransaction API error: Nested transactions are not supported. Do not call $transaction inside an active transaction.トランザクション内で $transaction を呼び出し
GassmaTransactionRollbackErrorTransaction API error: The transaction failed during commit and automatic rollback also failed. The affected sheets may be in an inconsistent state. Backup sheets are preserved for manual recovery: {backupSheetNames}コミット中の書き込み失敗後、バックアップからの自動復元にも失敗(backupSheetNames プロパティに残されたバックアップシート名の一覧)

CLI 設定ファイル系

CLI コマンド(gassma generate 等)の実行時に発生するエラーです。

エラーメッセージ発生条件
ConfigFileNotFoundErrorGASsmaConfigFileNotFoundError: config file not found at {configPath}--config で指定した設定ファイルが存在しない
GassmaConfigLoadErrorGASsmaConfigLoadError: Failed to load config file at {configPath}. {detail}設定ファイルの構文エラー・実行時エラー、既知キー(schema / datasource.url)の型不正、config オブジェクト以外のエクスポート
GassmaConfigEnvErrorCannot resolve environment variable: {name}.env() で参照した環境変数が未設定または空文字