コンテンツにスキップ

Yomitoku のエラーコード

コード体系

カテゴリ
10xx 環境・設定 無効な実行環境など
20xx 認証・ライセンス JWT・ライセンスキー関連
30xx ネットワーク/API サーバ通信・外部 API
40xx ファイル/リソース ファイルパス・存在確認
50xx モデル/カタログ ML モデル周りの操作
90xx その他/内部 想定外のエラーなど

エラーコード一覧

Error Code Error Name Description (EN) Description (JA) Exception Class
1001 INVALID_ENVIRONMENT Invalid execution environment (YOMITOKU_ENV is unset or invalid) 実行環境が無効です(YOMITOKU_ENV が未設定または無効です)。 YomiTokuValueError
1002 FAILED_DEVICE_INFO Failed to retrieve device information. Please check your environment. デバイス情報の取得に失敗しました。環境を確認してください。 YomiTokuValueError
2001 INVALID_JWT_TOKEN JWT token is invalid. Please check the token format and expiration. JWT トークンが無効です。トークンの形式と有効期限を確認してください。 YomiTokuValueError
2002 INVALID_EXPIRED_AT_FORMAT Invalid format for expired_at field in token. トークンの expired_at フィールドの形式が不正です。 YomiTokuValueError
2003 LICENSE_TOKEN_EXPIRED License token has expired. Please renew your license. ライセンストークンの有効期限が切れています。ライセンスを更新してください。 YomiTokuValueError
2004 LICENSE_KEY_NOT_SET License key is not set. Please set your license key in the environment variable YOMITOKU_LICENSE_KEY. ライセンスキーが設定されていません。環境変数 YOMITOKU_LICENSE_KEY にライセンスキーを設定してください。 YomiTokuValueError
2005 LICENSE_KEY_UNAUTHORIZED License key is unauthorized. Please check your license key. ライセンスキーが認証されていません。ライセンスキーを確認してください。 YomiTokuValueError
2006 INVALID_LICENSE_KEY License key is invalid. Please check your license key. ライセンスキーが無効です。ライセンスキーを確認してください。 YomiTokuValueError
2007 INVALID_MACHINE_FINGERPRINT Machine fingerprint mismatch. Please ensure the license is used on the correct machine. Alternatively, check the YOMITOKU_ENV environment variable. マシンのフィンガープリントが一致しません。ライセンスが正しいマシンで使用されていることを確認してください。もしくは,YOMITOKU_ENVの環境変数が正しい値か確認してください。 YomiTokuValueError
2008 FAILED_LICENSE_CHECK License check failed due to a server-side error. Please try again later or contact support if the issue persists. サーバー側のエラーによりライセンスチェックに失敗しました。後でもう一度お試しいただくか、解決しない場合はサポートにお問い合わせください。 YomiTokuValueError
2009 INVALID_PARAMETERS Invalid parameters. Please check the input parameters and their formats. パラメータが不正です。入力パラメータと形式を確認してください。 YomiTokuValueError
2010 MISSING_ENVIRONMENT_VARIABLE Required YOMITOKU_ENV is missing. Please ensure all necessary environment variables are set. YOMITOKU_ENVが設定されていません。必要な環境変数が設定されていることを確認してください。 YomiTokuValueError
3001 FAILED_GET_DEVICE_TOKEN Failed to obtain device token. デバイストークンの取得に失敗しました。 YomiTokuValueError
3002 FAILED_REGISTER_DEVICE_INFO Failed to register device information. デバイス情報の登録に失敗しました。 YomiTokuValueError
3003 INVALID_FILE_PATH Invalid file path when trying to access a resource. リソースにアクセスする際のファイルパスが不正です。 YomiTokuValueError
3004 FAILED_PRESIGNED_URL Failed to obtain presigned URL for model file download. モデルファイルダウンロード用の署名付き URL の取得に失敗しました。 YomiTokuValueError
4001 CONFIG_FILE_NOT_FOUND Configuration file not found. Please ensure the file exists at the specified path. 設定ファイルが見つかりません。指定されたパスにファイルが存在することを確認してください。 YomiTokuFileNotFoundError
4002 DEVICE_TOKEN_FILE_NOT_FOUND Device token file not found. Please ensure the file exists at the specified path. デバイストークンファイルが見つかりません。指定されたパスにファイルが存在することを確認してください。 YomiTokuFileNotFoundError
4003 DEVICE_INFO_FILE_NOT_FOUND Device info file not found. Please ensure the file exists at the specified path. デバイス情報ファイルが見つかりません。指定されたパスにファイルが存在することを確認してください。 YomiTokuFileNotFoundError
5001 NOT_SUBCLASS_BASEMODEL Model catalog does not inherit from BaseModelCatalog モデルカタログが BaseModelCatalog を継承していません。 YomiTokuTypeError
5002 NO_MODEL_REGISTERED No model is registered. 登録されているモデルがありません。 YomiTokuValueError
5003 UNKNOWN_MODEL Unknown model name. Please check the model name and ensure it is registered. モデル名が不明です。モデル名を確認し、登録されていることを確認してください。 YomiTokuValueError
5004 MODEL_ALREADY_REGISTERED Model has already been registered. Please check the model name and ensure it is not duplicated. モデルはすでに登録されています。モデル名を確認し、重複していないことを確認してください。 YomiTokuValueError
5005 MODULE_NOT_IMPLEMENTED Module not implemented. Please check if the module is implemented in the model catalog. モジュールが実装されていません。モデルカタログで実装されているか確認してください。 YomiTokuNotImplementedError
5006 MODULE_INTERNAL_ERROR Internal error in module. Please check the module implementation. モジュール内部でエラーが発生しました。モジュールの実装を確認してください。 YomiTokuRuntimeError
5007 GPU_OUT_OF_MEMORY GPU ran out of memory during inference. Reduce input size (e.g. --max-long-side) or use a smaller model. 推論中に GPU メモリが不足しました。入力サイズを小さくする(例: --max-long-side)か、より小さいモデルを使用してください。 YomiTokuRuntimeError
6001 IMAGE_FILE_NOT_FOUND Image or PDF file not found. Please ensure the file exists at the specified path. 画像または PDF ファイルが見つかりません。指定されたパスにファイルが存在することを確認してください。 YomiTokuFileNotFoundError
6002 UNSUPPORTED_IMAGE_FORMAT Unsupported image file format. Supported formats are: jpg, jpeg, png, bmp, tiff, tif. サポートされていない画像ファイル形式です。対応形式: jpg, jpeg, png, bmp, tiff, tif。 YomiTokuValueError
6003 PDF_NOT_SUPPORTED_BY_LOAD_IMAGE PDF is not accepted by load_image(). Please use load_pdf() instead. load_image() では PDF はサポートされていません。代わりに load_pdf() を使用してください。 YomiTokuValueError
6004 INVALID_IMAGE_DATA Invalid image data. Please check the image file and ensure it is not corrupted. 画像データが不正です。画像ファイルを確認し、破損していないことを確認してください。 YomiTokuValueError
6005 IMAGE_SIZE_TOO_SMALL Image size is smaller than minimum requirement. Minimum size is 32x32 pixels. 画像サイズが最小要件を満たしていません。最小サイズは 32x32 ピクセルです。 YomiTokuValueError
6006 NOT_PDF_FILE Given file is not a PDF. Please check the file format. 指定されたファイルは PDF ではありません。ファイル形式を確認してください。 YomiTokuValueError
6007 FAILED_PROCESS_PDF Failed to convert PDF pages to images. PDF ページの画像変換に失敗しました。 YomiTokuRuntimeError
6008 FONT_FILE_NOT_FOUND Font file not found. Please ensure the font file exists at the specified path. フォントファイルが見つかりません。指定されたパスにファイルが存在することを確認してください。 YomiTokuFileNotFoundError
6009 UNSUPPORTED_ENCODING Unsupported encoding for text processing. Supported encodings are: utf-8, utf-8-sig, shift-jis, euc-jp, cp932. サポートされていないテキストエンコーディングです。対応形式: utf-8, utf-8-sig, shift-jis, euc-jp, cp932。 YomiTokuValueError
6010 UNSUPPORTED_OUTPUT_FORMAT Unsupported output format for export. Supported formats are: json, csv, html, markdown, md, pdf. サポートされていない出力形式です。対応形式: json, csv, html, markdown, md, pdf。 YomiTokuValueError
7001 CLIENT_FILE_NOT_FOUND Input file not found. Please ensure the file exists at the specified path. 入力ファイルが見つかりません。指定されたパスにファイルが存在することを確認してください。 YomiTokuFileNotFoundError
7002 CLIENT_UNSUPPORTED_INPUT_FORMAT Unsupported input file format. Supported formats are: jpg, jpeg, png, bmp, tiff, tif, pdf. サポートされていない入力ファイル形式です。対応形式: jpg, jpeg, png, bmp, tiff, tif, pdf。 YomiTokuValueError
7003 CLIENT_UNSUPPORTED_FILE_FORMAT File extension cannot be mapped to a Content-Type for the server request. ファイルの拡張子をサーバーリクエスト用の Content-Type にマッピングできません。 YomiTokuValueError
7004 CLIENT_CONNECTION_ERROR Failed to connect to the server. Please check that the server is running and the URL is correct. サーバーへの接続に失敗しました。サーバーが起動しているか、URL が正しいか確認してください。 YomiTokuRuntimeError
7005 CLIENT_TIMEOUT Request to the server timed out. Please check the server load. サーバーへのリクエストがタイムアウトしました。サーバーの負荷状況を確認してください。 YomiTokuRuntimeError
7006 CLIENT_REQUEST_FAILED Request to the server failed due to a network error. ネットワークエラーによりサーバーへのリクエストに失敗しました。 YomiTokuRuntimeError
7007 CLIENT_SERVER_ERROR Server returned an error response. Please check the server logs. サーバーがエラーレスポンスを返しました。サーバーのログを確認してください。 YomiTokuRuntimeError
7008 CLIENT_INVALID_JSON_RESPONSE Server returned an invalid JSON response. サーバーが不正な JSON レスポンスを返しました。 YomiTokuRuntimeError
7009 CLIENT_EMPTY_RESULT Server returned no analysis results. Please check the input file and server logs. サーバーから解析結果が返されませんでした。入力ファイルとサーバーのログを確認してください。 YomiTokuRuntimeError
9000 UNKNOWN_ERROR An unknown error occurred. Please Contact support if the issue persists. 不明なエラーが発生しました。問題が解決しない場合はサポートにお問い合わせください。 YomiTokuRuntimeError

エラーハンドリング

エラークラスの属性を直接取得することで詳細のメタ情報を補足できます。

from yomitoku.analyzer import DocumentAnalyzer

try:
    analyzer = DocumentAnalyzer()
except Exception as e:
    error_code = e.error_code
    error_name = e.error_name
    error_ja_message = e.ja_description
    error_en_message = e.en_description

    payload = {
        "error_code": error_code,
        "error_name": error_name,
        "error_ja_message": error_ja_message,
        "error_en_message": error_en_message
    }

また、YomiTokuで利用する例外は標準例外の方を保っているため、標準例外で補足も可能です。 以下の例ではYomiTokuFileNotFoundErrorを標準例外FileNotFoundErrorで補足しています。

from yomitoku.data.functions import load_pdf

try:
    imgs = load_pdf("path of pdf")
except FileNotFoundError as e:
    error_code = e.error_code
    error_name = e.error_name
    error_ja_message = e.ja_description
    error_en_message = e.en_description

    payload = {
        "error_code": error_code,
        "error_name": error_name,
        "error_ja_message": error_ja_message,
        "error_en_message": error_en_message
    }

エラークラス一覧

Bases: Exception

A YomiToku exception class for handling errors with additional metadata.

Attributes:

Name Type Description
error_code str

The error code associated with the exception.

error_name str

The name of the error.

en_description str

A human-readable description of the error in English.

ja_description str

A human-readable description of the error in Japanese.

Source code in src/yomitoku/error_codes.py
class YomiTokuError(Exception):
    """
    A YomiToku exception class for handling errors with additional metadata.

    Attributes:
        error_code (str): The error code associated with the exception.
        error_name (str): The name of the error.
        en_description (str): A human-readable description of the error in English.
        ja_description (str): A human-readable description of the error in Japanese.
    """

    def __init__(
        self, error_code: str, error_name: str, en_description: str, ja_description: str
    ):
        super().__init__(en_description)
        self.error_code = error_code
        self.error_name = error_name
        self.en_description = en_description
        self.ja_description = ja_description

Bases: YomiTokuError, ValueError

A YomiToku exception class for ValueError with additional metadata. This class is used to handle errors related to invalid values or parameters

Attributes:

Name Type Description
error_code str

The error code associated with the exception.

error_name str

The name of the error.

en_description str

A human-readable description of the error in English.

ja_description str

A human-readable description of the error in Japanese.

Source code in src/yomitoku/error_codes.py
class YomiTokuValueError(YomiTokuError, ValueError):
    """A YomiToku exception class for ValueError with additional metadata.
    This class is used to handle errors related to invalid values or parameters

    Attributes:
        error_code (str): The error code associated with the exception.
        error_name (str): The name of the error.
        en_description (str): A human-readable description of the error in English.
        ja_description (str): A human-readable description of the error in Japanese.
    """

    pass

Bases: YomiTokuError, RuntimeError

A YomiToku exception class for RuntimeError with additional metadata. This class is used to handle errors that occur during the execution of the program,

Attributes:

Name Type Description
error_code str

The error code associated with the exception.

error_name str

The name of the error.

en_description str

A human-readable description of the error in English.

ja_description str

A human-readable description of the error in Japanese.

Source code in src/yomitoku/error_codes.py
class YomiTokuRuntimeError(YomiTokuError, RuntimeError):
    """A YomiToku exception class for RuntimeError with additional metadata.
    This class is used to handle errors that occur during the execution of the program,

    Attributes:
        error_code (str): The error code associated with the exception.
        error_name (str): The name of the error.
        en_description (str): A human-readable description of the error in English.
        ja_description (str): A human-readable description of the error in Japanese.
    """

    pass

Bases: YomiTokuError, FileNotFoundError

A YomiToku exception class for FileNotFoundError with additional metadata. This class is used to handle errors related to missing files or resources.

Attributes:

Name Type Description
error_code str

The error code associated with the exception.

error_name str

The name of the error.

en_description str

A human-readable description of the error in English.

ja_description str

A human-readable description of the error in Japanese.

Source code in src/yomitoku/error_codes.py
class YomiTokuFileNotFoundError(YomiTokuError, FileNotFoundError):
    """A YomiToku exception class for FileNotFoundError with additional metadata.
    This class is used to handle errors related to missing files or resources.

    Attributes:
        error_code (str): The error code associated with the exception.
        error_name (str): The name of the error.
        en_description (str): A human-readable description of the error in English.
        ja_description (str): A human-readable description of the error in Japanese.
    """

    pass

Bases: YomiTokuError, NotImplementedError

A YomiToku exception class for NotImplementedError with additional metadata. This class is used to handle errors related to unimplemented features or methods.

Attributes:

Name Type Description
error_code str

The error code associated with the exception.

error_name str

The name of the error.

en_description str

A human-readable description of the error in English.

ja_description str

A human-readable description of the error in Japanese.

Source code in src/yomitoku/error_codes.py
class YomiTokuNotImplementedError(YomiTokuError, NotImplementedError):
    """A YomiToku exception class for NotImplementedError with additional metadata.
    This class is used to handle errors related to unimplemented features or methods.

    Attributes:
        error_code (str): The error code associated with the exception.
        error_name (str): The name of the error.
        en_description (str): A human-readable description of the error in English.
        ja_description (str): A human-readable description of the error in Japanese.
    """

    pass

Bases: YomiTokuError, TypeError

A YomiToku exception class for TypeError with additional metadata. This class is used to handle errors related to incorrect types or type mismatches.

Attributes:

Name Type Description
error_code str

The error code associated with the exception.

error_name str

The name of the error.

en_description str

A human-readable description of the error in English.

ja_description str

A human-readable description of the error in Japanese.

Source code in src/yomitoku/error_codes.py
class YomiTokuTypeError(YomiTokuError, TypeError):
    """A YomiToku exception class for TypeError with additional metadata.
    This class is used to handle errors related to incorrect types or type mismatches.

    Attributes:
        error_code (str): The error code associated with the exception.
        error_name (str): The name of the error.
        en_description (str): A human-readable description of the error in English.
        ja_description (str): A human-readable description of the error in Japanese.
    """

    pass