Agent skill

Async Await Null Race Condition

by divinevideo in divinevideo/divine-mobile

Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

MPL-2.0Auto-check passedDevelopment

Install Async Await Null Race Condition

skills CLI
$ npx skills add divinevideo/divine-mobile --skill async-await-null-race-condition -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install divinevideo/divine-mobile async-await-null-race-condition --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/async-await-null-race-condition .claude/skills/async-await-null-race-condition && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
async-await-null-race-condition
GitHub stars
266
Token cost
~881 tokens
SKILL.md length
189 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

  • Works in 3 steps: Trigger the cancel/dispose operation… → No null check errors should occur → Operation should gracefully handle…
  • Object reference is nullified while awaiting
  • SKILL.md covers Problem, Context / Trigger Conditions, Solution and Verification, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Async Await Null Race Condition is an agent skill from divinevideo/divine-mobile. Fix "Null check operator used on a null value" errors when an object is set to null during an async await. Use when: (1) Object reference is nullified while awaiting, (2) Code accesses object with ! after await returns, (3) Cancel/dispose operations run concurrently with async operations on same object. Solution: capture local reference before await.

Its SKILL.md is about 880 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Async programming. The licence is MPL-2.0.

When your agent uses it

  • Object reference is nullified while awaiting
  • Code accesses object with !

Example prompts

  • “Null check operator used on a null value”
  • “/async-await-null-race-condition”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Trigger the cancel/dispose operation while async operation is in progress
  2. No null check errors should occur
  3. Operation should gracefully handle cancellation

What it can do on your machine

Read from SKILL.md and the folder at commit c3d6f7e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are dart).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Async Await Null Race Condition loads about 881 tokens when it runs. Until then it costs about 96 tokens; SKILL.md has 189 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~96
When it runs · the whole SKILL.md, loaded when a task matches
~881

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from divinevideo/divine-mobile at commit c3d6f7e, republished under its MPL-2.0 licence (© divinevideo). 189 words, ~881 tokens.

Download SKILL.mdSave it as .claude/skills/async-await-null-race-condition/SKILL.md (or your agent's skills folder).
name
async-await-null-race-condition
description
Fix "Null check operator used on a null value" errors when an object is set to null during an async await. Use when: (1) Object reference is nullified while awaiting, (2) Code accesses object with ! after await returns, (3) Cancel/dispose operations run concurrently with async operations on same object. Solution: capture local reference before await.
author
Claude Code
version
1.0.0
date
2026-02-01

Async Await Null Race Condition

Problem

When an async operation is awaiting, external code can set the object reference to null. When the await completes, accessing the object with ! throws "Null check operator used on a null value".

Context / Trigger Conditions

  • Error: Null check operator used on a null value
  • Pattern: await someObject!.asyncMethod() followed by someObject!.property
  • Object can be nullified by cancel/dispose/cleanup operations
  • Concurrent operations on shared mutable state
  • Typically seen with session objects, connection handlers, or service references

Solution

Wrong - Object can become null during await:
dart
Future<Result> waitForResponse() async {
  // _session might be set to null while we're awaiting
  final result = await _session!.waitForConnection();

  if (result == null) {
    // BUG: _session could be null here!
    final state = _session!.state;  // Throws null check error
    ...
  }
}

void cancel() {
  _session?.cancel();
  _session = null;  // This runs while waitForResponse is awaiting
}
Correct - Capture local reference before await:
dart
Future<Result> waitForResponse() async {
  // Capture reference BEFORE await
  final session = _session!;

  final result = await session.waitForConnection();

  // Check if cancelled during await
  if (_session == null) {
    return Result.cancelled();
  }

  if (result == null) {
    // Safe - using captured local reference
    final state = session.state;
    ...
  }
}

Verification

  1. Trigger the cancel/dispose operation while async operation is in progress
  2. No null check errors should occur
  3. Operation should gracefully handle cancellation

Example - Full Pattern

dart
class ConnectionManager {
  Session? _session;

  Future<ConnectionResult> connect() async {
    if (_session == null) {
      return ConnectionResult.failure('No session');
    }

    // Capture before await
    final session = _session!;

    final response = await session.waitForResponse(
      timeout: Duration(minutes: 2),
    );

    // Check if cancelled during await
    if (_session == null) {
      return ConnectionResult.failure('Cancelled');
    }

    // Safe to use captured reference
    if (response == null) {
      return ConnectionResult.failure(session.errorMessage);
    }

    return ConnectionResult.success(response);
  }

  void cancel() {
    _session?.cancel();
    _session?.dispose();
    _session = null;
  }
}

Notes

  • This pattern applies to any mutable reference that can be nullified externally
  • Common in Flutter/Dart with dispose patterns, Riverpod providers, and WebSocket sessions
  • The captured local reference keeps the object alive during the await
  • Always add a null check after await to detect cancellation
  • Consider using Completer cancellation patterns for more complex scenarios
  • riverpod-ref-read-in-dispose - Similar issue with Riverpod ref lifecycle
  • flutter-dispose-timer-test-failure - Timer callbacks after disposal

© divinevideo, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/async-await-null-race-condition of divinevideo/divine-mobile.

Open the folder on GitHubat commit c3d6f7e

Compare with similar skills

Async Await Null Race Condition next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Async Await Null Race Condition compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Async Await Null Race Condition this skilldivinevideo/divine-mobile266—~881Automated safety check: PassMPL-2.0
YugabyteDB ASH Instrumentationyugabyte/yugabyte-db11k—~4.5kAutomated safety check: PassCustom licence
Mirage VFS Adapter Authoringstrukto-ai/mirage3.7k—~2.5kAutomated safety check: PassApache-2.0
Golang Patternsantoniopaya22/go-rest-template1729 repos~3.5kAutomated safety check: PassNone
Rust Async Patternsdiodeme/Gold-Band14310 repos~3.1kAutomated safety check: PassAGPL-3.0
Swift Concurrencyhenrypldev/react-native-nitro-mlx1003 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • YugabyteDB ASH Instrumentation

    yugabyte/yugabyte-db

    Procedure for adding or changing YugabyteDB Active Session History wait states in TServer and DocDB C++ code, including the macro to use for sync and async paths.

    11k GitHub stars~4.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Builds or extends a custom Mirage virtual filesystem adapter for an API, database, object store or app data, with a working mount configuration and filesystem tests.

    3.7k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Golang Patterns

    antoniopaya22/go-rest-template

    Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.

    172 GitHub starsUsed in 9 repos~3.5k tokens
    DevelopmentAuto-check passed
  • Rust Async Patterns

    diodeme/Gold-Band

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns.

    143 GitHub starsUsed in 10 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Swift Concurrency

    henrypldev/react-native-nitro-mlx

    Diagnose Swift Concurrency issues, refactor callback-based code to async/await, and guide Swift 6 migration when working with tasks, actors, @MainActor, Sendable, data races, thread safety, or…

    100 GitHub starsUsed in 3 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Rust Engineer

    farm-fe/farm

    Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions.

    5.6k GitHub starsUsed in 1 repo~1.5k tokens
    DevelopmentAuto-check passed

More from divinevideo/divine-mobile

All 103 skills in this repo
  • Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".

    266 GitHub stars~931 tokensUpdated today
    Auto-check passed
  • Art Direct

    divinevideo/divine-mobile

    Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.

    266 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • AWS V4 Signing Custom Headers Gcs

    divinevideo/divine-mobile

    Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.

    266 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Bash Herestring Newline Secrets

    divinevideo/divine-mobile

    Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.

    266 GitHub stars~791 tokensUpdated today
    Auto-check passed
  • Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).

    266 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Certmanager Dns01 Gke Private Cluster

    divinevideo/divine-mobile

    Fix cert-manager DNS01 ACME challenges stuck in "pending" state with "DNS record not yet propagated" inside GKE private clusters, even when TXT records exist in Cloudflare DNS.

    266 GitHub stars~1.8k tokensUpdated today
    Auto-check passed

Categories

Questions about Async Await Null Race Condition

What does Async Await Null Race Condition do?

Fix "Null check operator used on a null value" errors when an object is set to null during an async await. Async Await Null Race Condition is an agent skill from divinevideo/divine-mobile. Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

When should I use Async Await Null Race Condition?

Async Await Null Race Condition fits situations like: object reference is nullified while awaiting; code accesses object with !.

How do I install Async Await Null Race Condition in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill async-await-null-race-condition -a claude-code`. Or copy the skill folder (.agents/skills/async-await-null-race-condition in divinevideo/divine-mobile) into .claude/skills/async-await-null-race-condition in your project. Claude Code loads it when a task matches its description.

How do I install Async Await Null Race Condition in Codex?

Run `npx skills add divinevideo/divine-mobile --skill async-await-null-race-condition -a codex`. Or copy the skill folder (.agents/skills/async-await-null-race-condition in divinevideo/divine-mobile) into .agents/skills/async-await-null-race-condition in your project. Codex loads it when a task matches its description.

Can I use Async Await Null Race Condition in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divinevideo/divine-mobile --skill async-await-null-race-condition -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/async-await-null-race-condition, .gemini/skills/async-await-null-race-condition, .github/skills/async-await-null-race-condition and .opencode/skills/async-await-null-race-condition in your project.

What does Async Await Null Race Condition need to run?

SKILL.md names no scripts, command-line tools or credentials: Async Await Null Race Condition is instructions for the agent only.

Does Async Await Null Race Condition access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Async Await Null Race Condition safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Async Await Null Race Condition use?

Async Await Null Race Condition is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Async Await Null Race Condition use?

About 881 tokens (SKILL.md is roughly 3.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Async Await Null Race Condition?

Skills that share tags, products or a category with Async Await Null Race Condition: YugabyteDB ASH Instrumentation (yugabyte/yugabyte-db, 11k stars), Mirage VFS Adapter Authoring (strukto-ai/mirage, 3.7k stars), Golang Patterns (antoniopaya22/go-rest-template, 172 stars) and Rust Async Patterns (diodeme/Gold-Band, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Async Await Null Race Condition?

divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 266 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 10, 2026.

Source: divinevideo/divine-mobile on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.