yikart/AiToEarn · warning · Error
插件未就绪,请先授权插件权限
Error message
插件未就绪,请先授权插件权限
What it means
login(platform) also throws ERROR_MESSAGES.PLUGIN_NOT_READY ('插件未就绪,请先授权插件权限') when the status is neither NOT_INSTALLED nor READY — i.e. the extension is detected but not yet initialized/authorized (e.g. needs user grant, still connecting, or in an error state). The guard prevents calling window.AIToEarnPlugin.login on a plugin that can't service it yet.
Source
Thrown at project/aitoearn-web/src/store/plugin/store.ts:735
console.error('同步账号失败:', result?.message)
return null
}
}
catch (error) {
console.error('同步账号到数据库失败:', error)
return null
}
},
/** 登录到指定平台 */
async login(platform: PluginPlatformType) {
const { status, platformAccounts } = get()
if (status === Status.NOT_INSTALLED)
throw new Error(ERROR_MESSAGES.PLUGIN_NOT_INSTALLED)
if (status !== Status.READY)
throw new Error(ERROR_MESSAGES.PLUGIN_NOT_READY)
try {
const result = await window.AIToEarnPlugin!.login(platform)
set({
platformAccounts: { ...platformAccounts, [platform]: result },
})
await methods.syncAccountToDatabase(platform)
return result
}
catch (error) {
console.error('登录失败:', error)
throw error
}
},
/** 发布内容到指定平台 */
async publish(params: PublishParams, onProgress?: ProgressCallback) {
const { status, publishingPlatforms, platformProgress } = get()View on GitHub (pinned to d3aa8bea5b)
Solutions
- Open the extension and grant the requested permissions, then reload and wait for status to become READY before calling login().
- Subscribe to the plugin store status and only enable the login action when status === Status.READY.
- If stuck non-ready, call the store's re-init/detect routine or reinstall/update the extension.
- Catch the error by message and show 'authorize plugin permissions' guidance with a retry after re-checking status.
Example fix
// before
await usePluginStore.getState().login('douyin')
// after
const { status } = usePluginStore.getState()
if (status !== Status.READY) {
await waitForPluginReady()
}
await usePluginStore.getState().login('douyin') Defensive patterns
Strategy: validation
Validate before calling
const { status } = usePluginStore.getState()
if (status !== Status.READY) {
await waitForPluginReady(timeoutMs) // subscribe to status changes
}
await login(platform) Type guard
function canLogin(status: Status): boolean {
return status !== Status.NOT_INSTALLED && status === Status.READY
} Try / catch
try {
await login(platform)
}
catch (e) {
if (e.message === ERROR_MESSAGES.PLUGIN_NOT_READY) {
showAuthorizePermissionsDialog()
return
}
throw e
} Prevention
- Await status READY via a store subscription before invoking login
- Surface the extension's permission grant UI when status is stuck non-ready
- Debounce login clicks during the startup handshake window
- Handle extension updates that require re-authorization with a clear prompt
When it happens
Trigger: Calling login() while status is a non-READY intermediate/failed state: extension detected but permissions not granted, content-script handshake incomplete, or the store marked the plugin not-ready after a failed init.
Common situations: User clicks login immediately after page load before the plugin handshake finishes; extension permissions revoked leaving status non-ready; extension version update requiring re-authorization.
Related errors
- 请先安装 Aitoearn 浏览器插件
- 插件未安装或未就绪
- 插件未安装或未就绪
- PLUGIN_PROXY_REQUEST_UNAVAILABLE
- ResponseCode.ConfigEditorWriteFailed
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/d575aeee5cb5f11c.
Report an issue: GitHub.